- 论坛徽章:
- 0
|
fastdfs--java -连接池-V1.0.zip
(5.74 KB, 下载次数: 87)
敬爱的鱼大:
解救我吧,,,这个异常总是出现的很诡异,我现在怀颖不是我客户端的问题。现在看异常,。
描述:
LoopUploadTest是我连接池上传测试类。我的文件上传操作类为:ImageServer(接口),ImageServerImpl负责实现。ConnectionPool是具体的保持 连接类。
里面有两个容器,busyConnectionPool用于存放正在使用的连接,idleConnectionPool用于存放空闲的连接,checkin和checkout负责将空闲和正在使用的连接转换。
里面有个drop方法。上传文件发生异常的时候,我会将连接关闭,并删除,用新的代替。里面还有一点特殊功能,就是当管理平台和trackerserver之间的关系 ,如果trackserver意外终止,但一会又好了,管理 平台不用重新启动,连接池可以重新建立。
整体思路就如上边,但现在老是报异常。当我在LoopUploadTest的间隔 Thread.sleep(1000*60);会时不时的报错,,,,间隔少了就不会,
求解答。。
求解救。。。。
源代码已经上边,望有空查看。项目在急。。。。
group1/M00/01/B2/wKgEdVC8MjXIvxqEAAAmlrYh34k3622898
java.io.IOException: recv package size -1 != 10
at org.csource.fastdfs.ProtoCommon.recvHeader(ProtoCommon.java:206)
at org.csource.fastdfs.ProtoCommon.recvPackage(ProtoCommon.java:242)
at org.csource.fastdfs.TrackerClient.getStoreStorage(TrackerClient.java:143)
at org.csource.fastdfs.StorageClient.newWritableStorageConnection(StorageClient.java:1912)
at org.csource.fastdfs.StorageClient.do_upload_file(StorageClient.java:702)
at org.csource.fastdfs.StorageClient.upload_file(StorageClient.java:207)
at org.csource.fastdfs.StorageClient.upload_file(StorageClient.java:225)
at org.csource.fastdfs.StorageClient1.upload_file1(StorageClient1.java:112)
at com.imageserver.ImageServerImpl.send(ImageServerImpl.java:79)
at com.imageserver.ImageServerImpl.uploadFile(ImageServerImpl.java:62)
at com.imageserver.ImageServerImpl.uploadFile(ImageServerImpl.java:55)
at test.LoopUploadTest$1.run(LoopUploadTest.java:53)
2012-12-3 14:00:48 com.imageserver.pool.ImageServerPoolSysout warn
警告: ImageServerPool drop a connnection
2012-12-3 14:00:48 com.imageserver.pool.ImageServerPoolSysout warn
警告: ImageServerPool size:4
2012-12-3 14:00:48 com.imageserver.pool.ImageServerPoolSysout warn
警告: ImageServerPool add a connnection
2012-12-3 14:00:48 com.imageserver.pool.ImageServerPoolSysout warn
警告: ImageServerPool size:5
java.io.IOException: recv package size -1 != 10
at org.csource.fastdfs.ProtoCommon.recvHeader(ProtoCommon.java:206)
at org.csource.fastdfs.ProtoCommon.recvPackage(ProtoCommon.java:242)
at org.csource.fastdfs.TrackerClient.getStoreStorage(TrackerClient.java:143)
at org.csource.fastdfs.StorageClient.newWritableStorageConnection(StorageClient.java:1912)
at org.csource.fastdfs.StorageClient.do_upload_file(StorageClient.java:702)
at org.csource.fastdfs.StorageClient.upload_file(StorageClient.java:207)
at org.csource.fastdfs.StorageClient.upload_file(StorageClient.java:225)
at org.csource.fastdfs.StorageClient1.upload_file1(StorageClient1.java:112)
at com.imageserver.ImageServerImpl.send(ImageServerImpl.java:79)
at com.imageserver.ImageServerImpl.uploadFile(ImageServerImpl.java:62)
at com.imageserver.ImageServerImpl.uploadFile(ImageServerImpl.java:55)
at test.LoopUploadTest$1.run(LoopUploadTest.java:53)
java.io.IOException: recv package size -1 != 10
at org.csource.fastdfs.ProtoCommon.recvHeader(ProtoCommon.java:206)
at org.csource.fastdfs.ProtoCommon.recvPackage(ProtoCommon.java:242)
at org.csource.fastdfs.TrackerClient.getStoreStorage(TrackerClient.java:143)
at org.csource.fastdfs.StorageClient.newWritableStorageConnection(StorageClient.java:1912)
at org.csource.fastdfs.StorageClient.do_upload_file(StorageClient.java:702)
at org.csource.fastdfs.StorageClient.upload_file(StorageClient.java:207)
at org.csource.fastdfs.StorageClient.upload_file(StorageClient.java:225)
at org.csource.fastdfs.StorageClient1.upload_file1(StorageClient1.java:112)
at com.imageserver.ImageServerImpl.send(ImageServerImpl.java:79)
at com.imageserver.ImageServerImpl.uploadFile(ImageServerImpl.java:62)
at com.imageserver.ImageServerImpl.uploadFile(ImageServerImpl.java:55)
at test.LoopUploadTest$1.run(LoopUploadTest.java:53)
2012-12-3 14:01:48 com.imageserver.pool.ImageServerPoolSysout warn
警告: ImageServerPool drop a connnection
2012-12-3 14:01:48 com.imageserver.pool.ImageServerPoolSysout warn
警告: ImageServerPool size:4
2012-12-3 14:01:48 com.imageserver.pool.ImageServerPoolSysout warn
警告: ImageServerPool add a connnection
2012-12-3 14:01:48 com.imageserver.pool.ImageServerPoolSysout warn
警告: ImageServerPool size:5
java.io.IOException: recv package size -1 != 10
at org.csource.fastdfs.ProtoCommon.recvHeader(ProtoCommon.java:206)
at org.csource.fastdfs.ProtoCommon.recvPackage(ProtoCommon.java:242)
at org.csource.fastdfs.TrackerClient.getStoreStorage(TrackerClient.java:143)
at org.csource.fastdfs.StorageClient.newWritableStorageConnection(StorageClient.java:1912)
at org.csource.fastdfs.StorageClient.do_upload_file(StorageClient.java:702)
at org.csource.fastdfs.StorageClient.upload_file(StorageClient.java:207)
at org.csource.fastdfs.StorageClient.upload_file(StorageClient.java:225)
at org.csource.fastdfs.StorageClient1.upload_file1(StorageClient1.java:112)
at com.imageserver.ImageServerImpl.send(ImageServerImpl.java:79)
at com.imageserver.ImageServerImpl.uploadFile(ImageServerImpl.java:62)
at com.imageserver.ImageServerImpl.uploadFile(ImageServerImpl.java:55)
at test.LoopUploadTest$1.run(LoopUploadTest.java:53)
java.io.IOException: recv package size -1 != 10
at org.csource.fastdfs.ProtoCommon.recvHeader(ProtoCommon.java:206)
at org.csource.fastdfs.ProtoCommon.recvPackage(ProtoCommon.java:242)
at org.csource.fastdfs.TrackerClient.getStoreStorage(TrackerClient.java:143)
at org.csource.fastdfs.StorageClient.newWritableStorageConnection(StorageClient.java:1912)
at org.csource.fastdfs.StorageClient.do_upload_file(StorageClient.java:702)
at org.csource.fastdfs.StorageClient.upload_file(StorageClient.java:207)
at org.csource.fastdfs.StorageClient.upload_file(StorageClient.java:225)
at org.csource.fastdfs.StorageClient1.upload_file1(StorageClient1.java:112)
at com.imageserver.ImageServerImpl.send(ImageServerImpl.java:79)
at com.imageserver.ImageServerImpl.uploadFile(ImageServerImpl.java:62)
at com.imageserver.ImageServerImpl.uploadFile(ImageServerImpl.java:55)
at test.LoopUploadTest$1.run(LoopUploadTest.java:53)
2012-12-3 14:02:48 com.imageserver.pool.ImageServerPoolSysout warn
警告: ImageServerPool drop a connnection
2012-12-3 14:02:48 com.imageserver.pool.ImageServerPoolSysout warn
警告: ImageServerPool size:4
2012-12-3 14:02:48 com.imageserver.pool.ImageServerPoolSysout warn
警告: ImageServerPool add a connnection
2012-12-3 14:02:48 com.imageserver.pool.ImageServerPoolSysout warn
警告: ImageServerPool size:5
java.io.IOException: recv package size -1 != 10
at org.csource.fastdfs.ProtoCommon.recvHeader(ProtoCommon.java:206)
at org.csource.fastdfs.ProtoCommon.recvPackage(ProtoCommon.java:242)
at org.csource.fastdfs.TrackerClient.getStoreStorage(TrackerClient.java:143)
at org.csource.fastdfs.StorageClient.newWritableStorageConnection(StorageClient.java:1912)
at org.csource.fastdfs.StorageClient.do_upload_file(StorageClient.java:702)
at org.csource.fastdfs.StorageClient.upload_file(StorageClient.java:207)
at org.csource.fastdfs.StorageClient.upload_file(StorageClient.java:225)
at org.csource.fastdfs.StorageClient1.upload_file1(StorageClient1.java:112)
at com.imageserver.ImageServerImpl.send(ImageServerImpl.java:79)
at com.imageserver.ImageServerImpl.uploadFile(ImageServerImpl.java:62)
at com.imageserver.ImageServerImpl.uploadFile(ImageServerImpl.java:55)
at test.LoopUploadTest$1.run(LoopUploadTest.java:53)
group1/M00/01/B2/wKgEdVC8MyXHWVyUAAAmlrYh34k9827938
group1/M00/01/B2/wKgEdVC8M2GlPtJ6AAAmlrYh34k4039707
java.io.IOException: recv package size -1 != 10
at org.csource.fastdfs.ProtoCommon.recvHeader(ProtoCommon.java:206)
at org.csource.fastdfs.ProtoCommon.recvPackage(ProtoCommon.java:242)
at org.csource.fastdfs.TrackerClient.getStoreStorage(TrackerClient.java:143)
at org.csource.fastdfs.StorageClient.newWritableStorageConnection(StorageClient.java:1912)
at org.csource.fastdfs.StorageClient.do_upload_file(StorageClient.java:702)
at org.csource.fastdfs.StorageClient.upload_file(StorageClient.java:207)
at org.csource.fastdfs.StorageClient.upload_file(StorageClient.java:225)
at org.csource.fastdfs.StorageClient1.upload_file1(StorageClient1.java:112)
at com.imageserver.ImageServerImpl.send(ImageServerImpl.java:79)
at com.imageserver.ImageServerImpl.uploadFile(ImageServerImpl.java:62)
at com.imageserver.ImageServerImpl.uploadFile(ImageServerImpl.java:55)
at test.LoopUploadTest$1.run(LoopUploadTest.java:53)
|
|