Open conanca opened 11 years ago
try now
fixed
when activeMQ server is Linux, this problem will still happen.
I try to fix it like this: class StompClient Line 142:
do {
ch = in.read();
if(ch<0){
onCriticalError(new IOException("stome server disconnected!"));
return;
}
} while (ch < 'A' || ch > 'Z');
By @conanca comment (0ct 19,2012) context : Linux with activeMQ still have SocketException at line class StompClient Line 144 (ch=in.read()) when executing the test class => Exception occurs when client.disconnect(); is invoked in test class. (Line 130) then I fixed it by modifying StompClient Line 142 as
// skip lead trash
do {
try {
ch = in.read();
} catch (SocketException e) {
if (!running) { // exception to ignore
break;
} else {
throw e;// normal exception
}
}
if (ch < 0){
onCriticalError(new IOException("stome server disconnected!"));
return;
}
} while (ch < 'A' || ch > 'Z');
if (!running) break;
// read frame
(...)
=> ignore exception when SocketException is thrown at in.read() and the reader should be stopped (running == false)
I have a java app, the client always keep a stomp connection in it; When notice server stop, the process of this java app will be in high CPU occupation,but stomp client didn't hava any error print out.