我收到以下异常
java.io.IOException: Bad file descriptor
at gnu.java.nio.channels.FileChannelImpl.size(libgcj.so.10)
at java.io.RandomAccessFile.length(libgcj.so.10)
at ServerSendFile.getAndSetDataFromFile(ServerSendFile.java:738)
at ServerSendFile.runOnce(ServerSendFile.java:613)
at ServerSendFile.startSendFile(ServerSendFile.java:212)
at Server.procMsgFromNetstorm(Server.java:583)
at Server.tcpRecv(Server.java:465)
at Server.run(Server.java:292)
在这里,我有Server.java
它ServerSendFile
作为每个即将到来的请求的线程运行Server.java
的目的ServerSendFile
是发送从文件读取的数据
有很多代码,我只粘贴了它导致的小快照rafLogFile.length();
try
{
long fileSize = rafLogFile.length();
//if the file size may size is zero then, return to fetch the data next innterval
if(fileSize == 0)
{
return true;
}
}
catch(IOException eio)
{
cmonLog.stackTraceLog(className, "getAndSetDataFromFile", "", "", "Exception caught in retriving length of log file = " + lastFile.getAbsolutePath(), eio);
}