ObjectOutputStream永远挂起

时间:2013-08-04 22:04:44

标签: java sockets

我有一个使用套接字连接到服务器的客户端。有时下面的写对象方法会挂起。你有什么想法吗?

public void writeObject(Object obj) throws IOException, NullPointerException {
    if(obj instanceof CMSRequestMessage)
        CMSLogger.interfaceDebugLogger.info("Starting Method  writeObject for transID ["
                                        + ((CMSRequestMessage)obj).getTransID() + "] ");
    objectOutputStream.writeObject(obj);
    objectOutputStream.flush();
    objectOutputStream.reset();

    CMSLogger.interfaceDebugLogger.info("End Method  writeObject for transID ["
           + ((CMSRequestMessage)obj).getTransID() + "] "); // never reaches here 
}

0 个答案:

没有答案