private void handleAspInactiveAck(AspImpl aspImpl, ASPInactiveAck aspInactiveAck) { FSM aspLocalFSM = aspImpl.getLocalFSM(); if (aspLocalFSM == null) { logger.error( String.format( "Received ASPINACTIVE_ACK=%s for ASP=%s. But local FSM is null.", aspInactiveAck, this.aspFactoryImpl.getName())); return; } AsImpl asImpl = (AsImpl) aspImpl.getAs(); try { aspLocalFSM.signal(TransitionState.ASP_INACTIVE_ACK); if (this.aspFactoryImpl.getFunctionality() == Functionality.IPSP) { // If its IPSP, we know NTFY will not be received, // so transition AS FSM here FSM asPeerFSM = asImpl.getPeerFSM(); if (asPeerFSM == null) { logger.error( String.format( "Received ASPINACTIVE_ACK=%s for ASP=%s. But Peer FSM of AS=%s is null.", aspInactiveAck, this.aspFactoryImpl.getName(), asImpl)); return; } if (asImpl.getTrafficModeType().getMode() == TrafficModeType.Loadshare) { // If it is loadshare and if there is atleast one other ASP // who ACTIVE, dont transition AS to INACTIVE for (Asp asp : asImpl.applicationServerProcesses) { AspImpl remAspImpl = (AspImpl) asp; FSM aspPeerFSM = remAspImpl.getPeerFSM(); AspState aspState = AspState.getState(aspPeerFSM.getState().getName()); if (aspState == AspState.ACTIVE) { return; } } } // TODO : Check if other ASP are INACTIVE, if yes ACTIVATE them asPeerFSM.setAttribute(AsImpl.ATTRIBUTE_ASP, aspImpl); asPeerFSM.signal(TransitionState.AS_STATE_CHANGE_PENDING); } } catch (UnknownTransitionException e) { logger.error(e.getMessage(), e); } }
private void handleAspActiveAck( AspImpl aspImpl, ASPActiveAck aspActiveAck, TrafficModeType trMode) { AsImpl asImpl = (AsImpl) aspImpl.getAs(); if (trMode == null) { trMode = aspImpl.getAs().getDefaultTrafficModeType(); } asImpl.setTrafficModeType(trMode); FSM aspLocalFSM = aspImpl.getLocalFSM(); if (aspLocalFSM == null) { logger.error( String.format( "Received ASPACTIVE_ACK=%s for ASP=%s. But local FSM is null.", aspActiveAck, this.aspFactoryImpl.getName())); return; } try { aspLocalFSM.signal(TransitionState.ASP_ACTIVE_ACK); if (aspFactoryImpl.getFunctionality() == Functionality.IPSP) { // If its IPSP, we know NTFY will not be received, // so transition AS FSM here FSM asPeerFSM = asImpl.getPeerFSM(); if (asPeerFSM == null) { logger.error( String.format( "Received ASPACTIVE_ACK=%s for ASP=%s. But Peer FSM of AS=%s is null.", aspActiveAck, this.aspFactoryImpl.getName(), asImpl)); return; } asPeerFSM.setAttribute(AsImpl.ATTRIBUTE_ASP, aspImpl); asPeerFSM.signal(TransitionState.AS_STATE_CHANGE_ACTIVE); } } catch (UnknownTransitionException e) { logger.error(e.getMessage(), e); } }