fastdfs删除文件的源码,有没有可扩展的先进行判断fastdfs有无此文件的方法?
源码如下:
public int delete_file(String group_name, String remote_filename) throws IOException, MyException {
boolean bNewConnection = this.newUpdatableStorageConnection(group_name, remote_filename);
Socket storageSocket = this.storageServer.getSocket();
try {
this.send_package(ProtoCommon.STORAGE_PROTO_CMD_DELETE_FILE, group_name, remote_filename);
ProtoCommon.RecvPackageInfo pkgInfo = ProtoCommon.recvPackage(storageSocket.getInputStream(),
ProtoCommon.STORAGE_PROTO_CMD_RESP, 0);
this.errno = pkgInfo.errno;
return pkgInfo.errno;
} catch (IOException ex) {
if (!bNewConnection) {
try {
this.storageServer.close();
} catch (IOException ex1) {
ex1.printStackTrace();
} finally {
this.storageServer = null;
}
}
throw ex;
} finally {
if (bNewConnection) {
try {
this.storageServer.close();
} catch (IOException ex1) {
ex1.printStackTrace();
} finally {
this.storageServer = null;
}
}
}
}
求助!!!Fastdfs删除文件的问题!
最新推荐文章于 2025-09-13 10:30:11 发布
本文深入探讨了FastDFS删除文件的源码实现,详细分析了如何通过建立连接、发送命令包并接收响应来完成文件删除操作。同时,讨论了在删除前进行文件存在性检查的可行性。
228

被折叠的 条评论
为什么被折叠?



