public boolean isState(int s) { if (isClustered) { Integer state = (Integer) cfgCtx.getPropertyNonReplicable(STATE_KEY); // state has not yet been replicated.. // first replication occurs on first timeout or fault return state == null || state == s; } else { return localState == s; } }
/** * To get the position of the current EPR for use. Default to 0 - i.e. first endpoint * * @return The position of the current EPR */ public int getCurrentEndpointIndex() { if (isClusteringEnabled) { Object value = cfgCtx.getPropertyNonReplicable(this.CURRENT_EPR_PROP_KEY); if (value == null) { return 0; } else if (value instanceof Integer) { return ((Integer) value); } } else { return currentEPR; } return 0; }
public boolean isState(int s) { if (isClustered) { Integer state = (Integer) cfgCtx.getPropertyNonReplicable(STATE_KEY); // state has not yet been replicated.. // first replication occurs on first timeout or fault boolean isState = false; if (state == null) { if (s == ST_ACTIVE) { isState = true; } } else { isState = state == s; } return isState; } else { return localState == s; } }
/** * To get the position of the current EPR for use. Default to 0 - i.e. first endpoint * * @return The position of the current EPR */ public int getCurrentEndpointIndex() { if (isClusteringEnabled) { Object value = cfgCtx.getPropertyNonReplicable(this.CURRENT_EPR_PROP_KEY); if (value == null) { return 0; } else if (value instanceof Integer) { return ((Integer) value); } } else { return currentEPR; } return 0; }
/** * Private method to return the current state as a loggable string * * @return the current state as a string */ private String getStateAsString() { Integer state = localState; if (isClustered) { state = (Integer) cfgCtx.getPropertyNonReplicable(STATE_KEY); if (state == null) { return "ACTIVE"; } } switch (state) { case ST_ACTIVE : return "ACTIVE"; case ST_TIMEOUT : return "TIMEOUT"; case ST_SUSPENDED : return "SUSPENDED"; case ST_OFF: return "MAINTNENCE"; default: return "UNKNOWN"; } }
private SessionInformation getSessionInformation(String sessionID) { if (isClustered) { return (SessionInformation) configCtx.getPropertyNonReplicable(SESSION_IDS + sessionID); } else { return establishedSessions.get(sessionID); } }
/** * Private method to return the current state as a loggable string * * @return the current state as a string */ private String getStateAsString() { Integer state = localState; if (isClustered) { state = (Integer) cfgCtx.getPropertyNonReplicable(STATE_KEY); if (state == null) { return "ACTIVE"; } } switch (state) { case ST_ACTIVE : return "ACTIVE"; case ST_TIMEOUT : return "TIMEOUT"; case ST_SUSPENDED : return "SUSPENDED"; case ST_OFF: return "MAINTNENCE"; default: return "UNKNOWN"; } }
private boolean isLocalMemberInitialized() { if (configContext == null) { return false; } Object clusterInitialized = configContext.getPropertyNonReplicable(ClusteringConstants.CLUSTER_INITIALIZED); return clusterInitialized != null && clusterInitialized.equals("true"); }
/** * Get the property value corresponding to a specified key * * @param key The key of the property * @return The value of the property or null if the key does not exist */ public Object getProperty(String key) { if (isClusteringEnabled) { return cfgCtx.getPropertyNonReplicable(PROPERTY_KEY_PREFIX + key); } else { return localProperties.get(key); } }
private boolean isLocalMemberInitialized() { if (configContext == null) { return false; } Object clusterInitialized = configContext.getPropertyNonReplicable(ClusteringConstants.CLUSTER_INITIALIZED); return clusterInitialized != null && clusterInitialized.equals("true"); }
private SessionInformation getSessionInformation(String sessionID) { if (isClustered) { return (SessionInformation) configCtx.getPropertyNonReplicable(SESSION_IDS + sessionID); } else { return establishedSessions.get(sessionID); } }
/** * Get the property value corresponding to a specified key * * @param key The key of the property * @return The value of the property or null if the key does not exist */ public Object getProperty(String key) { if (isClusteringEnabled) { return cfgCtx.getPropertyNonReplicable(PROPERTY_KEY_PREFIX + key); } else { return localProperties.get(key); } }
public void execute(ConfigurationContext configContext) throws ClusteringFault { log.info("Received state initialization message"); // Run this code only if this node is not already initialized if (configContext. getPropertyNonReplicable(ClusteringConstants.RECD_STATE_INIT_MSG) == null) { configContext. setNonReplicableProperty(ClusteringConstants.RECD_STATE_INIT_MSG, "true"); // log.info("Received state initialization message"); if (commands != null) { for (int i = 0; i < commands.length; i++) { commands[i].execute(configContext); } } } }
public void execute(ConfigurationContext configContext) throws ClusteringFault { log.info("Received state initialization message"); // Run this code only if this node is not already initialized if (configContext. getPropertyNonReplicable(ClusteringConstants.RECD_STATE_INIT_MSG) == null) { configContext. setNonReplicableProperty(ClusteringConstants.RECD_STATE_INIT_MSG, "true"); // log.info("Received state initialization message"); if (commands != null) { for (int i = 0; i < commands.length; i++) { commands[i].execute(configContext); } } } }
private void initDataHolder() { if (configctx != null) { if (dataHolder == null) { dataHolder = (ThrottleDataHolder) configctx.getPropertyNonReplicable(ThrottleConstants.THROTTLE_INFO_KEY); synchronized (configctx) { if (dataHolder == null) { dataHolder = new ThrottleDataHolder(); configctx.setNonReplicableProperty(ThrottleConstants.THROTTLE_INFO_KEY, dataHolder); } } } } }
/** * Endpoint has processed a message successfully */ public void onSuccess() { if (isClustered) { Integer state = (Integer) cfgCtx.getPropertyNonReplicable(STATE_KEY); if ((state != null) && ((state != ST_ACTIVE) && (state != ST_OFF))) { log.info("Endpoint : " + endpointName + " currently " + getStateAsString() + " will now be marked active since it processed its last message"); setState(ST_ACTIVE); } } else { if (localState != ST_ACTIVE && localState != ST_OFF) { log.info("Endpoint : " + endpointName + " currently " + getStateAsString() + " will now be marked active since it processed its last message"); setState(ST_ACTIVE); } } }
public boolean mediate(MessageContext synCtx) { log.debug("Mediation started ....... " + AutoscaleOutMediator.class.getName()); ConfigurationContext configCtx = ((Axis2MessageContext) synCtx).getAxis2MessageContext().getConfigurationContext(); String domain = (String) synCtx.getProperty(AutoscaleConstants.TARGET_DOMAIN); // gets the corresponding sub domain String subDomain = (String) synCtx.getProperty(AutoscaleConstants.TARGET_SUB_DOMAIN); String tokenId = (String) synCtx.getProperty(AutoscaleConstants.REQUEST_ID); @SuppressWarnings("unchecked") Map<String, Map<String, AppDomainContext>> appDomainContexts = (Map<String, Map<String, AppDomainContext>>) configCtx.getPropertyNonReplicable(AutoscaleConstants.APP_DOMAIN_CONTEXTS); AppDomainContext appDomainContext = null ; if(appDomainContexts.get(domain) != null){ appDomainContext = appDomainContexts.get(domain).get(subDomain); } if (appDomainContext != null) { appDomainContext.removeRequestToken(tokenId); System.setProperty(AutoscaleConstants.IS_TOUCHED, "true"); } else { log.debug("AppDomainContext not found for domain " + domain+" and sub domain : "+subDomain); } return true; }
/** * Endpoint has processed a message successfully */ public void onSuccess() { if (isClustered) { Integer state = (Integer) cfgCtx.getPropertyNonReplicable(STATE_KEY); if ((state != null) && ((state != ST_ACTIVE) && (state != ST_OFF))) { log.info("Endpoint : " + endpointName + printEndpointAddress() + " currently " + getStateAsString() + " will now be marked active since it processed its last message"); setState(ST_ACTIVE); } } else { if (localState != ST_ACTIVE && localState != ST_OFF) { log.info("Endpoint : " + endpointName + printEndpointAddress() + " currently " + getStateAsString() + " will now be marked active since it processed its last message"); setState(ST_ACTIVE); } } }
LoadBalancerConfiguration lbConfig) { Map<String, Map<String, ?>> oldAppDomainContexts = (Map<String, Map<String, ?>>) configCtx.getPropertyNonReplicable(AutoscaleConstants.APP_DOMAIN_CONTEXTS); Map<String, Map<String, ?>> newAppDomainContexts = new HashMap<String, Map<String, ?>>();
getPropertyNonReplicable(ClusteringConstants.CLUSTER_INITIALIZED) == null) { log.warn("Received message " + msg + " before cluster initialization has been completed from " +