/* * XXX:: If ACTIVE went dead before any passive moved to STANDBY state, then the cluster is hung and there is no going * around it. If ACTIVE in persistent mode, it can come back and recover the cluster */ @Override public void startElection() { debugInfo("Starting election"); synchronized (electionLock) { if (electionInProgress) return; electionInProgress = true; } try { State initial = clusterStatePersistor.getInitialState(); // Went down as either PASSIVE_STANDBY or UNITIALIZED, either way we need to wait for the // active to zap, just skip // the election and wait for a zap. if (initial != null && !initial.equals(ACTIVE_COORDINATOR)) { info( "Skipping election and waiting for the active to zap since this this L2 did not go down as active."); } else if (state == START_STATE || state == PASSIVE_STANDBY) { runElection(); } else { info("Ignoring Election request since not in right state"); } } finally { synchronized (electionLock) { electionInProgress = false; } } }
@Override public void l2StateChanged(StateChangedEvent sce) { State state = sce.getCurrentState(); if (state.equals(StateManager.ACTIVE_COORDINATOR)) { server.updateActivateTime(); } debugPrintln( "***** msg=[" + stateChangeNotificationInfo.getMsg(state) + "] attrName=[" + stateChangeNotificationInfo.getAttributeName(state) + "] attrType=[" + stateChangeNotificationInfo.getAttributeType(state) + "] stateName=[" + state.getName() + "]"); _sendNotification( stateChangeNotificationInfo.getMsg(state), stateChangeNotificationInfo.getAttributeName(state), stateChangeNotificationInfo.getAttributeType(state), Boolean.FALSE, Boolean.TRUE); }
private void fireStateChangedOperatorEvent() { TSAManagementEventPayload tsaManagementEventPayload = new TSAManagementEventPayload("TSA.L2.STATE_CHANGE"); tsaManagementEventPayload.getAttributes().put("State", state.getName()); TerracottaRemoteManagement.getRemoteManagementInstance() .sendEvent(tsaManagementEventPayload.toManagementEvent()); operatorEventLogger.fireOperatorEvent( TerracottaOperatorEventFactory.createClusterNodeStateChangedEvent(state.getName())); }
public void setCurrentL2State(State state) { map.put(L2_STATE_KEY, state.getName()); }