@@ -22,7 +22,7 @@ public class OStorageRemotePushThread extends Thread {
2222 private final String host ;
2323 private final int retryDelay ;
2424 private final long requestTimeout ;
25- private OChannelBinary network ;
25+ private volatile OChannelBinary network ;
2626 private final BlockingQueue <Object > blockingQueue = new SynchronousQueue <>();
2727 private volatile OBinaryRequest currentRequest ;
2828 private volatile boolean shutDown ;
@@ -85,27 +85,31 @@ public void run() {
8585 }
8686 } catch (IOException | OException e ) {
8787 pushHandler .onPushDisconnect (this .network , e );
88- while (!currentThread (). isInterrupted ()) {
88+ while (!isInterrupted ()) {
8989 try {
9090 Thread .sleep (retryDelay );
9191 } catch (InterruptedException x ) {
92- currentThread (). interrupt ();
92+ interrupt ();
9393 }
94- if (!currentThread (). isInterrupted ()) {
94+ if (!isInterrupted ()) {
9595 try {
9696 synchronized (this ) {
97- network = pushHandler .getNetwork (this .host );
97+ this .network = null ;
98+ this .network = pushHandler .getNetwork (this .host );
9899 }
99100 pushHandler .onPushReconnect (this .host );
100101 break ;
101102 } catch (OIOException ex ) {
103+ if (this .network != null ) {
104+ pushHandler .onPushDisconnect (this .network , ex );
105+ }
102106 // Noting it just retry
103107 }
104108 }
105109 }
106110 } catch (InterruptedException e ) {
107111 pushHandler .onPushDisconnect (this .network , e );
108- currentThread (). interrupt ();
112+ interrupt ();
109113 } catch (Throwable e ) {
110114 OLogManager .instance ().warn (this , "Push thread error " , e );
111115 throw e ;
0 commit comments