@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 initClose() { DisconnectedState nextState = new DisconnectedState(stateController, null); stateController.setState(nextState); } }
@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); } }
@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 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 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 run() { if (!isCancelled) { // Try reconnect if possible, otherwise announce close if (nrConnectAttempts != 0) { // Reconnect is allowed WaitingForReconnectState nextState = new WaitingForReconnectState(stateController, nrConnectAttempts); stateController.setState(nextState); } else { stateController.setExternalState(new WampClient.DisconnectedState(cause)); DisconnectedState nextState = new DisconnectedState(stateController, cause); stateController.setState(nextState); } } else { // Connection cancel attempt was successfully cancelled. // This is the final state stateController.setExternalState(new WampClient.DisconnectedState(null)); DisconnectedState nextState = new DisconnectedState(stateController, null); stateController.setState(nextState); } } });
@Override public void run() { if (!isCancelled) { // Try reconnect if possible, otherwise announce close if (nrConnectAttempts != 0) { // Reconnect is allowed WaitingForReconnectState nextState = new WaitingForReconnectState(stateController, nrConnectAttempts); stateController.setState(nextState); } else { stateController.setExternalState(new WampClient.DisconnectedState(cause)); DisconnectedState nextState = new DisconnectedState(stateController, cause); stateController.setState(nextState); } } else { // Connection cancel attempt was successfully cancelled. // This is the final state stateController.setExternalState(new WampClient.DisconnectedState(null)); DisconnectedState nextState = new DisconnectedState(stateController, null); stateController.setState(nextState); } } });
@Override public void run() { if (!isCancelled) { // Try reconnect if possible, otherwise announce close if (nrConnectAttempts != 0) { // Reconnect is allowed WaitingForReconnectState nextState = new WaitingForReconnectState(stateController, nrConnectAttempts); stateController.setState(nextState); } else { stateController.setExternalState(new WampClient.DisconnectedState(cause)); DisconnectedState nextState = new DisconnectedState(stateController, cause); stateController.setState(nextState); } } else { // Connection cancel attempt was successfully cancelled. // This is the final state stateController.setExternalState(new WampClient.DisconnectedState(null)); DisconnectedState nextState = new DisconnectedState(stateController, null); stateController.setState(nextState); } } });
@Override public void onEnter(ClientState lastState) { if (lastState instanceof InitialState) { stateController.setExternalState(new WampClient.ConnectingState()); } // Check for valid number of connects assert (nrConnectAttempts != 0); // Decrease remaining number of reconnects if it's not infinite if (nrConnectAttempts > 0) nrConnectAttempts--; // Starts an connection attempt to the router connectionController = new QueueingConnectionController(stateController.scheduler(), new ClientConnectionListener(stateController)); try { connectingCon = stateController.clientConfig().connector().connect(stateController.scheduler(), this, connectionController); } catch (Exception e) { // Catch exceptions that can happen during creating the channel // These are normally signs that something is wrong with our configuration // Therefore we don't trigger retries stateController.setCloseError(e); stateController.setExternalState(new WampClient.DisconnectedState(e)); DisconnectedState newState = new DisconnectedState(stateController, e); // This is a reentrant call to setState. However it works as onEnter is the last call in setState stateController.setState(newState); } }
@Override public void onEnter(ClientState lastState) { if (lastState instanceof InitialState) { stateController.setExternalState(new WampClient.ConnectingState()); } // Check for valid number of connects assert (nrConnectAttempts != 0); // Decrease remaining number of reconnects if it's not infinite if (nrConnectAttempts > 0) nrConnectAttempts--; // Starts an connection attempt to the router connectionController = new QueueingConnectionController(stateController.scheduler(), new ClientConnectionListener(stateController)); try { connectingCon = stateController.clientConfig().connector().connect(stateController.scheduler(), this, connectionController); } catch (Exception e) { // Catch exceptions that can happen during creating the channel // These are normally signs that something is wrong with our configuration // Therefore we don't trigger retries stateController.setCloseError(e); stateController.setExternalState(new WampClient.DisconnectedState(e)); DisconnectedState newState = new DisconnectedState(stateController, e); // This is a reentrant call to setState. However it works as onEnter is the last call in setState stateController.setState(newState); } }
@Override public void onEnter(ClientState lastState) { if (lastState instanceof InitialState) { stateController.setExternalState(new WampClient.ConnectingState()); } // Check for valid number of connects assert (nrConnectAttempts != 0); // Decrease remaining number of reconnects if it's not infinite if (nrConnectAttempts > 0) nrConnectAttempts--; // Starts an connection attempt to the router connectionController = new QueueingConnectionController(stateController.scheduler(), new ClientConnectionListener(stateController)); try { connectingCon = stateController.clientConfig().connector().connect(stateController.scheduler(), this, connectionController); } catch (Exception e) { // Catch exceptions that can happen during creating the channel // These are normally signs that something is wrong with our configuration // Therefore we don't trigger retries stateController.setCloseError(e); stateController.setExternalState(new WampClient.DisconnectedState(e)); DisconnectedState newState = new DisconnectedState(stateController, e); // This is a reentrant call to setState. However it works as onEnter is the last call in setState stateController.setState(newState); } }