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); } } } } }
/** * To replicates the states of the already exist caller * * @param callerContext The states of the caller * @param id The id of the remote caller */ public void flushCallerContext(CallerContext callerContext, String id) { if (dataHolder != null && callerContext != null && id != null) { String key = keyPrefix + id; dataHolder.addCallerContext(key, callerContext); // have to do ,because we always gets // any property as non-replicable replicateCaller(id); } }
return dataHolder.getCallerContext(keyPrefix + id);
getProperty(ThrottleConstants.THROTTLE_INFO_KEY); if (dataHolder == null) { dataHolder = new ThrottleDataHolder(); configContext.setNonReplicableProperty (ThrottleConstants.THROTTLE_INFO_KEY, dataHolder); concurrentAccessController = throttle.getConcurrentAccessController(); if (concurrentAccessController != null) { dataHolder.setConcurrentAccessController(key, concurrentAccessController);
concurrentAccessController.incrementAndGet(); if (isClusteringEnable) { dataHolder.setConcurrentAccessController (key, concurrentAccessController); concurrentAccessController.incrementAndGet(); if (isClusteringEnable) { dataHolder.setConcurrentAccessController (key, concurrentAccessController);
public static ThrottleContext getApplicationThrottleContext(MessageContext synCtx, ThrottleDataHolder dataHolder, String applicationId, String policyKeyApplication) { synchronized (lock) { Object throttleContext = dataHolder.getThrottleContext(applicationId); if(throttleContext == null){ return createThrottleContext(synCtx, dataHolder, applicationId, policyKeyApplication); } return (ThrottleContext)throttleContext; } }
/** * Helper method to remove a caller * * @param id The id of the caller */ private void removeCaller(String id) { Long time = (Long) keyToTimeStampMap.get(id); // if (time != null) { if (dataHolder != null && keyPrefix != null) { log.debug("Removing the caller with the configuration id " + id); dataHolder.removeCaller(keyPrefix + id); } if (time != null) { callersMap.remove(time); keyToTimeStampMap.remove(id); } }
public void destroy() { //if synapse configuration refreshes we need to drop the previous throttle data if (configContext != null) { dataHolder.removeConcurrentAccessController(key); } if (onAcceptMediator instanceof ManagedLifecycle) { ((ManagedLifecycle) onAcceptMediator).destroy(); } if (onRejectMediator instanceof ManagedLifecycle) { ((ManagedLifecycle) onRejectMediator).destroy(); } }
throttleDataHolder.getConcurrentAccessController(key); if (log.isDebugEnabled()) { log.debug("Getting local ConcurrentAccessController for key : " + key); localAccessController = throttleDataHolder.getConcurrentAccessController(key); if (localAccessController != null) { localAccessController.updateCounter(action);
Throttle throttle = ThrottleFactory.createMediatorThrottle(PolicyEngine.getPolicy((OMElement) entryValue)); ThrottleContext context = throttle.getThrottleContext(ThrottleConstants.ROLE_BASED_THROTTLE_KEY); dataHolder.addThrottleContext(applicationId, context); return context; } catch (ThrottleException e) {
throttle.getConcurrentAccessController(); if (concurrentAccessController != null) { dataHolder.setConcurrentAccessController (key, concurrentAccessController);
dataHolder = (ThrottleDataHolder) cc.getProperty(ThrottleConstants.THROTTLE_INFO_KEY); if (dataHolder == null) { dataHolder = new ThrottleDataHolder(); cc.setNonReplicableProperty(ThrottleConstants.THROTTLE_INFO_KEY, dataHolder);
if (key != null) { if (dataHolder != null && keyPrefix != null) { c = dataHolder.getCallerContext(keyPrefix + key); if (key != null) { if (dataHolder != null && keyPrefix != null) { c = (CallerContext) dataHolder.getCallerContext(keyPrefix + key);
dataHolder.addCallerContext(keyPrefix + id, callerContext);
if (key != null) { if (dataHolder != null && keyPrefix != null) { c = dataHolder.getCallerContext(keyPrefix + key); if (key != null) { if (dataHolder != null && keyPrefix != null) { c = (CallerContext) dataHolder.getCallerContext(keyPrefix + key);
ThrottleDataHolder dataHolder = (ThrottleDataHolder) configContext.getProperty(ThrottleConstants.THROTTLE_INFO_KEY); CallerContext callerContext = dataHolder.getCallerContext(key);
ThrottleDataHolder dataHolder = (ThrottleDataHolder) configContext.getProperty(ThrottleConstants.THROTTLE_INFO_KEY); CallerContext callerContext = dataHolder.getCallerContext(key); if (callerContext != null) { callerId = callerContext.getId();