@@ -130,7 +146,7 @@ public class WebSocketConnection extends Thread {
...
@@ -130,7 +146,7 @@ public class WebSocketConnection extends Thread {
webSocket.setPingInterval(50*1000);
webSocket.setPingInterval(50*1000);
webSocket=webSocket.connect();
webSocket=webSocket.connect();
System.out.println("WebSocketConnection.createWebSocket(): status of connection: "+connectionId+": "+eventListener.getState().toString());
System.out.println(Thread.currentThread().getName()+" "+currentDate()+" WebSocketConnection.createWebSocket(): status of connection: "+connectionId+": "+eventListener.getState().toString());
// if (isDisconnected() && isDisconnectedWaitingForMaintenance()) {
//Let the websocket maintenance a chance to handle the closed websocket
try{
try{
this.sendReconnectRequest();
synchronized(this){
synchronized(this){
this.closedWebSocketWaitingForMaintenance=true;
//wait that manager signals that the reconnect completed and this connection instance can be exited
this.sendReconnectRequest();
}
while(this.closedWebSocketWaitingForMaintenance){
try{
try{
Thread.sleep(500);
System.out.println(Thread.currentThread().getName()+" "+currentDate()+"waitForDisconnection wait for waitingForMaintenance notification [adapterId-"+adapterId+" ,connectionId-"+connectionId+"]");
}catch(InterruptedExceptione){
while(!isDisconnectedWaitingForMaintenance())
e.printStackTrace();
this.wait();
System.out.println(Thread.currentThread().getName()+" "+currentDate()+"waitForDisconnection wait for waitingForMaintenance WAS SIGNALED [adapterId-"+adapterId+" ,connectionId-"+connectionId+"]");
// System.out.println(Thread.currentThread().getName() + " "+ currentDate() + " maintenance reconnect. UNEXCEPTED SIGNLE for: [adapterId-" + adapterId + " ,connectionId-" + connectionId + "], #1closing the old websocket connection and dont know why");
catch(UnsupportedEncodingExceptione){
}catch(UnsupportedEncodingExceptione){
System.out.println("reconnect failed with error: "+e+", [adapterId-"+adapterId+" ,connectionId-"+connectionId+"] closing websocket connection");
System.out.println(Thread.currentThread().getName()+" "+currentDate()+" maintenance reconnect msg was completed for: [adapterId-"+adapterId+" ,connectionId-"+connectionId+"], closing the old websocket connection");
e.printStackTrace();
e.printStackTrace();
try{
try{
Thread.sleep(500);
Thread.sleep(500);
...
@@ -234,8 +299,11 @@ public class WebSocketConnection extends Thread {
...
@@ -234,8 +299,11 @@ public class WebSocketConnection extends Thread {
Stringstr=connectionId+" "+currentDate()+" "+"a WebSocket frame was not sent to the server because a close frame has already been sent: "+frame.toString();
Stringstr=connectionId+" "+currentDate()+" "+"onFrameUnsent: a WebSocket frame was not sent to the server because a close frame has already been sent: "+frame.toString();
logging(str,eTraceLevel.eDEBUG,false);
logging(str,eTraceLevel.eDEBUG,false);
}
}
...
@@ -481,7 +484,7 @@ public class WebSocketEventListener implements WebSocketListener {
...
@@ -481,7 +484,7 @@ public class WebSocketEventListener implements WebSocketListener {