use of org.apache.synapse.commons.throttle.core.ConcurrentAccessReplicator in project wso2-synapse by wso2.
the class AbstractEndpoint method informFailure.
protected void informFailure(MessageContext synCtx, int errorCode, String errorMsg) {
Boolean isConcurrencyThrottleEnabled = (Boolean) synCtx.getProperty(SynapseConstants.SYNAPSE_CONCURRENCY_THROTTLE);
if (isConcurrencyThrottleEnabled != null && isConcurrencyThrottleEnabled) {
ConcurrentAccessController concurrentAccessController = (ConcurrentAccessController) synCtx.getProperty(SynapseConstants.SYNAPSE_CONCURRENT_ACCESS_CONTROLLER);
int available = concurrentAccessController.incrementAndGet();
int concurrentLimit = concurrentAccessController.getLimit();
if (log.isDebugEnabled()) {
log.debug("Concurrency Throttle : Connection returned" + " :: " + available + " of available of " + concurrentLimit + " connections");
}
ConcurrentAccessReplicator concurrentAccessReplicator = (ConcurrentAccessReplicator) synCtx.getProperty(SynapseConstants.SYNAPSE_CONCURRENT_ACCESS_REPLICATOR);
String throttleKey = (String) synCtx.getProperty(SynapseConstants.SYNAPSE_CONCURRENCY_THROTTLE_KEY);
if (concurrentAccessReplicator != null) {
concurrentAccessReplicator.replicate(throttleKey, true);
}
}
if (synCtx.getProperty(SynapseConstants.LAST_ENDPOINT) == null) {
setErrorOnMessage(synCtx, errorCode, errorMsg);
}
invokeNextFaultHandler(synCtx);
}
Aggregations