{"action":"opened","issue":{"url":"https://api.github.com/repos/slimina/thrift-zookeeper-rpc/issues/2","labels_url":"https://api.github.com/repos/slimina/thrift-zookeeper-rpc/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/slimina/thrift-zookeeper-rpc/issues/2/comments","events_url":"https://api.github.com/repos/slimina/thrift-zookeeper-rpc/issues/2/events","html_url":"https://github.com/slimina/thrift-zookeeper-rpc/issues/2","id":111306518,"number":2,"title":"Client类中关于线程休眠的问题","user":{"login":"gaowenming","id":392945,"avatar_url":"https://avatars.githubusercontent.com/u/392945?v=3","gravatar_id":"","url":"https://api.github.com/users/gaowenming","html_url":"https://github.com/gaowenming","followers_url":"https://api.github.com/users/gaowenming/followers","following_url":"https://api.github.com/users/gaowenming/following{/other_user}","gists_url":"https://api.github.com/users/gaowenming/gists{/gist_id}","starred_url":"https://api.github.com/users/gaowenming/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gaowenming/subscriptions","organizations_url":"https://api.github.com/users/gaowenming/orgs","repos_url":"https://api.github.com/users/gaowenming/repos","events_url":"https://api.github.com/users/gaowenming/events{/privacy}","received_events_url":"https://api.github.com/users/gaowenming/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-14T02:00:28Z","updated_at":"2015-10-14T02:00:28Z","closed_at":null,"body":"ApplicationContext context = new ClassPathXmlApplicationContext(\"spring-context-thrift-client.xml\");\r\n\t\t\tEchoSerivce.Iface echoSerivce = (EchoSerivce.Iface) context.getBean(\"echoSerivce\");\r\n\t\t\tThread.sleep(1000);\r\n\t\t\tfor (int i = 0; i < 100; i++) {\r\n\t\t\t\tThread.sleep(3000);\r\n\t\t\t\ttry {\r\n\t\t\t\t\tSystem.out.println(echoSerivce.echo(\"hello----\"+i));\r\n\t\t\t\t} catch (Exception e) {\r\n\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t}\r\n\t\t\t\t//TThread t = new TThread(echoSerivce);\r\n\t\t\t\t//t.start();\r\n\t\t\t}\r\n\t\t\tThread.sleep(3000000);\r\n\r\n在测试的时候发现，如果把Thread.sleep(1000);去掉的话，会出现\r\njava.lang.NullPointerException\r\nat org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1188)\r\n\r\n如果把Thread.sleep(3000000);会出现\r\njava.io.IOException: 远程主机强迫关闭了一个现有的连接。\r\n\tat sun.nio.ch.SocketDispatcher.read0(Native Method)\r\n\tat sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)\r\n\tat sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)\r\n\tat sun.nio.ch.IOUtil.read(IOUtil.java:197)\r\n\tat sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:379)\r\n\tat org.apache.thrift.transport.TNonblockingSocket.read(TNonblockingSocket.java:142)\r\n\tat org.apache.thrift.server.AbstractNonblockingServer$FrameBuffer.internalRead(AbstractNonblockingServer.java:539)\r\n\tat org.apache.thrift.server.AbstractNonblockingServer$FrameBuffer.read(AbstractNonblockingServer.java:338)\r\n\tat org.apache.thrift.server.AbstractNonblockingServer$AbstractSelectThread.handleRead(AbstractNonblockingServer.java:203)\r\n\tat org.apache.thrift.server.TThreadedSelectorServer$SelectorThread.select(TThreadedSelectorServer.java:586)\r\n\tat org.apache.thrift.server.TThreadedSelectorServer$SelectorThread.run(TThreadedSelectorServer.java:541)\r\n\r\n\r\n在实际环境中，肯定不会用休眠的方式吧？"}}