java - Exception is only thrown in debug+breakpoint -
so i've got thread receive info client. there objectinputreader read data. if objectinputreader couldn't initialized in try-catch, happens if client disconnected without notifying server, try-catch should phone call exception.
so i've got "disconnect client" handling in catch-statement. never happens.
but if i'm running server on debug , set breakpoint in catch-statement exception occurs , handled want it. breakpoint, never without (debug or release).
i'm using eclipse, think newest version.
did ever happen have "bug"? or doing wrong?
private static runnable receive = new runnable(){ @override public void run() { // todo auto-generated method stub objectinputstream ois; while(true) { for(int = 0; < listsockets.size();i++){ seek { ois = new objectinputstream(listsockets.get(i).getinputstream()); int receivestate = (integer)ois.readobject(); datapackage dp = (datapackage)ois.readobject(); listdata.set(i,dp); if(receivestate == 1){ //client disconnected user disconnectclient(i); i--; } ois.close(); } grab (ioexception | classnotfoundexception e) { disconnectclient(i); i--; } } } } };
allways maintain in mind debugging might influence program. when inspect variables jvm causes lot's of tostring() methods called. if 1 tostring() method changes state of 1 of objects, result change. seek
} grab (ioexception | classnotfoundexception e) { system.out.println("i here"); disconnectclient(i); i--; }
to see if programme jumps grab block or disconnectclient method has flaw. if add together few more system.out. might see programm stops.
java network-programming
No comments:
Post a Comment