@Override public void onCompletion(IWampConnectionFuture<Void> future) { // Is called once the disconnect from the previous transport has happened if (nrReconnectAttempts == 0) { DisconnectedState newState = new DisconnectedState(stateController, null); stateController.setState(newState); } else { WaitingForReconnectState newState = new WaitingForReconnectState(stateController, nrReconnectAttempts); stateController.setState(newState); } }
@Override public void initClose() { DisconnectedState nextState = new DisconnectedState(stateController, null); stateController.setState(nextState); } }
@Override public void initClose() { DisconnectedState nextState = new DisconnectedState(stateController, null); stateController.setState(nextState); } }
@Override public void onCompletion(IWampConnectionFuture<Void> future) { // Is called once the disconnect from the previous transport has happened if (nrReconnectAttempts == 0) { DisconnectedState newState = new DisconnectedState(stateController, null); stateController.setState(newState); } else { WaitingForReconnectState newState = new WaitingForReconnectState(stateController, nrReconnectAttempts); stateController.setState(newState); } }
@Override public void initClose() { DisconnectedState nextState = new DisconnectedState(stateController, null); stateController.setState(nextState); } }
@Override public void onCompletion(IWampConnectionFuture<Void> future) { // Is called once the disconnect from the previous transport has happened if (nrReconnectAttempts == 0) { DisconnectedState newState = new DisconnectedState(stateController, null); stateController.setState(newState); } else { WaitingForReconnectState newState = new WaitingForReconnectState(stateController, nrReconnectAttempts); stateController.setState(newState); } }
@Override public void call() { if (stateController.currentState() != WaitingForReconnectState.this) return; // Reconnect now ConnectingState newState = new ConnectingState(stateController, nrReconnectAttempts); stateController.setState(newState); } }, stateController.clientConfig().reconnectInterval(), TimeUnit.MILLISECONDS);
@Override public void call() { if (stateController.currentState() != WaitingForReconnectState.this) return; // Reconnect now ConnectingState newState = new ConnectingState(stateController, nrReconnectAttempts); stateController.setState(newState); } }, stateController.clientConfig().reconnectInterval(), TimeUnit.MILLISECONDS);
@Override public void call() { if (stateController.currentState() != WaitingForReconnectState.this) return; // Reconnect now ConnectingState newState = new ConnectingState(stateController, nrReconnectAttempts); stateController.setState(newState); } }, stateController.clientConfig().reconnectInterval(), TimeUnit.MILLISECONDS);
@Override public void run() { if (!(currentState instanceof InitialState)) return; // Try to connect afterwards // This guarantees that the external state will always // switch to connecting, even when the attempt immediately // fails int nrConnects = clientConfig.totalNrReconnects(); if (nrConnects == 0) nrConnects = 1; ConnectingState newState = new ConnectingState(StateController.this, nrConnects); setState(newState); } });
@Override public void run() { if (!(currentState instanceof InitialState)) return; // Try to connect afterwards // This guarantees that the external state will always // switch to connecting, even when the attempt immediately // fails int nrConnects = clientConfig.totalNrReconnects(); if (nrConnects == 0) nrConnects = 1; ConnectingState newState = new ConnectingState(StateController.this, nrConnects); setState(newState); } });
@Override public void run() { if (!(currentState instanceof InitialState)) return; // Try to connect afterwards // This guarantees that the external state will always // switch to connecting, even when the attempt immediately // fails int nrConnects = clientConfig.totalNrReconnects(); if (nrConnects == 0) nrConnects = 1; ConnectingState newState = new ConnectingState(StateController.this, nrConnects); setState(newState); } });
@Override public void initClose() { reconnectSubscription.unsubscribe(); // Current external state is Connecting // Move to disconnected stateController.setExternalState(new WampClient.DisconnectedState(null)); // And switch the internal state also to Disconnected DisconnectedState newState = new DisconnectedState(stateController, null); stateController.setState(newState); } }
@Override public void initClose() { reconnectSubscription.unsubscribe(); // Current external state is Connecting // Move to disconnected stateController.setExternalState(new WampClient.DisconnectedState(null)); // And switch the internal state also to Disconnected DisconnectedState newState = new DisconnectedState(stateController, null); stateController.setState(newState); } }
@Override public void initClose() { reconnectSubscription.unsubscribe(); // Current external state is Connecting // Move to disconnected stateController.setExternalState(new WampClient.DisconnectedState(null)); // And switch the internal state also to Disconnected DisconnectedState newState = new DisconnectedState(stateController, null); stateController.setState(newState); } }
void closeIncompleteSession(Throwable disconnectReason, String optAbortReason, boolean reconnectAllowed) { // Send abort to the remote if (optAbortReason != null) { AbortMessage msg = new AbortMessage(null, optAbortReason); connectionController.sendMessage(msg, IWampConnectionPromise.Empty); } int nrReconnects = reconnectAllowed ? nrReconnectAttempts : 0; if (nrReconnects == 0) { stateController.setExternalState(new WampClient.DisconnectedState(disconnectReason)); } WaitingForDisconnectState newState = new WaitingForDisconnectState(stateController, nrReconnects); connectionController.close(true, newState.closePromise()); stateController.setState(newState); }
void closeIncompleteSession(Throwable disconnectReason, String optAbortReason, boolean reconnectAllowed) { // Send abort to the remote if (optAbortReason != null) { AbortMessage msg = new AbortMessage(null, optAbortReason); connectionController.sendMessage(msg, IWampConnectionPromise.Empty); } int nrReconnects = reconnectAllowed ? nrReconnectAttempts : 0; if (nrReconnects == 0) { stateController.setExternalState(new WampClient.DisconnectedState(disconnectReason)); } WaitingForDisconnectState newState = new WaitingForDisconnectState(stateController, nrReconnects); connectionController.close(true, newState.closePromise()); stateController.setState(newState); }
void closeIncompleteSession(Throwable disconnectReason, String optAbortReason, boolean reconnectAllowed) { // Send abort to the remote if (optAbortReason != null) { AbortMessage msg = new AbortMessage(null, optAbortReason); connectionController.sendMessage(msg, IWampConnectionPromise.Empty); } int nrReconnects = reconnectAllowed ? nrReconnectAttempts : 0; if (nrReconnects == 0) { stateController.setExternalState(new WampClient.DisconnectedState(disconnectReason)); } WaitingForDisconnectState newState = new WaitingForDisconnectState(stateController, nrReconnects); connectionController.close(true, newState.closePromise()); stateController.setState(newState); }
void closeSession(Throwable disconnectReason, String optCloseMessageReason, boolean reconnectAllowed) { // Send goodbye message with close reason to the remote if (optCloseMessageReason != null) { GoodbyeMessage msg = new GoodbyeMessage(null, optCloseMessageReason); connectionController.sendMessage(msg, IWampConnectionPromise.Empty); } stateController.setExternalState(new WampClient.DisconnectedState(disconnectReason)); int nrReconnectAttempts = reconnectAllowed ? stateController.clientConfig().totalNrReconnects : 0; if (nrReconnectAttempts != 0) { stateController.setExternalState(new WampClient.ConnectingState()); } clearSessionData(); WaitingForDisconnectState newState = new WaitingForDisconnectState(stateController, nrReconnectAttempts); connectionController.close(true, newState.closePromise()); stateController.setState(newState); }
void closeSession(Throwable disconnectReason, String optCloseMessageReason, boolean reconnectAllowed) { // Send goodbye message with close reason to the remote if (optCloseMessageReason != null) { GoodbyeMessage msg = new GoodbyeMessage(null, optCloseMessageReason); connectionController.sendMessage(msg, IWampConnectionPromise.Empty); } stateController.setExternalState(new WampClient.DisconnectedState(disconnectReason)); int nrReconnectAttempts = reconnectAllowed ? stateController.clientConfig().totalNrReconnects() : 0; if (nrReconnectAttempts != 0) { stateController.setExternalState(new WampClient.ConnectingState()); } clearSessionData(); WaitingForDisconnectState newState = new WaitingForDisconnectState(stateController, nrReconnectAttempts); connectionController.close(true, newState.closePromise()); stateController.setState(newState); }