Class ThrottleGroups
- java.lang.Object
-
- org.apache.manifoldcf.connectorcommon.throttler.ThrottleGroups
-
- All Implemented Interfaces:
IThrottleGroups
public class ThrottleGroups extends java.lang.Object implements IThrottleGroups
An implementation of IThrottleGroups, which establishes a JVM-wide pool of throttlers that can be used as a resource by any connector that needs it.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String_rcsidprotected IThreadContextthreadContextThe thread contextprotected static ThrottlerthrottlerThe actual static pool
-
Constructor Summary
Constructors Constructor Description ThrottleGroups(IThreadContext threadContext)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreateOrUpdateThrottleGroup(java.lang.String throttleGroupType, java.lang.String throttleGroup, IThrottleSpec throttleSpec)Set or update throttle specification for a throttle group.voiddestroy()Shut down throttler permanently.voidfreeUnusedResources()Free unused resources.java.util.Set<java.lang.String>getThrottleGroups(java.lang.String throttleGroupType)Get all existing throttle groups for a throttle group type.IConnectionThrottlerobtainConnectionThrottler(java.lang.String throttleGroupType, java.lang.String throttleGroup, java.lang.String[] binNames)Construct connection throttler for connections with specific bin names.voidpoll()Poll periodically, to update ALL cluster-wide statistics and allocation.voidpoll(java.lang.String throttleGroupType)Poll periodically, to update cluster-wide statistics and allocation.voidremoveThrottleGroup(java.lang.String throttleGroupType, java.lang.String throttleGroup)Remove a throttle group.
-
-
-
Field Detail
-
_rcsid
public static final java.lang.String _rcsid
- See Also:
- Constant Field Values
-
threadContext
protected final IThreadContext threadContext
The thread context
-
throttler
protected static final Throttler throttler
The actual static pool
-
-
Constructor Detail
-
ThrottleGroups
public ThrottleGroups(IThreadContext threadContext) throws ManifoldCFException
Constructor- Throws:
ManifoldCFException
-
-
Method Detail
-
getThrottleGroups
public java.util.Set<java.lang.String> getThrottleGroups(java.lang.String throttleGroupType) throws ManifoldCFExceptionGet all existing throttle groups for a throttle group type. The throttle group type typically describes a connector class, while the throttle group represents a namespace of bin names specific to that connector class.- Specified by:
getThrottleGroupsin interfaceIThrottleGroups- Parameters:
throttleGroupType- is the throttle group type.- Returns:
- the set of throttle groups for that group type.
- Throws:
ManifoldCFException
-
removeThrottleGroup
public void removeThrottleGroup(java.lang.String throttleGroupType, java.lang.String throttleGroup) throws ManifoldCFExceptionRemove a throttle group.- Specified by:
removeThrottleGroupin interfaceIThrottleGroups- Parameters:
throttleGroupType- is the throttle group type.throttleGroup- is the throttle group.- Throws:
ManifoldCFException
-
createOrUpdateThrottleGroup
public void createOrUpdateThrottleGroup(java.lang.String throttleGroupType, java.lang.String throttleGroup, IThrottleSpec throttleSpec) throws ManifoldCFExceptionSet or update throttle specification for a throttle group. This creates the throttle group if it does not yet exist.- Specified by:
createOrUpdateThrottleGroupin interfaceIThrottleGroups- Parameters:
throttleGroupType- is the throttle group type.throttleGroup- is the throttle group.throttleSpec- is the desired throttle specification object.- Throws:
ManifoldCFException
-
obtainConnectionThrottler
public IConnectionThrottler obtainConnectionThrottler(java.lang.String throttleGroupType, java.lang.String throttleGroup, java.lang.String[] binNames) throws ManifoldCFException
Construct connection throttler for connections with specific bin names. This object is meant to be embedded with a connection pool of similar objects, and used to gate the creation of new connections in that pool.- Specified by:
obtainConnectionThrottlerin interfaceIThrottleGroups- Parameters:
throttleGroupType- is the throttle group type.throttleGroup- is the throttle group.binNames- are the connection type bin names.- Returns:
- the connection throttling object, or null if the pool is being shut down.
- Throws:
ManifoldCFException
-
poll
public void poll(java.lang.String throttleGroupType) throws ManifoldCFExceptionPoll periodically, to update cluster-wide statistics and allocation.- Specified by:
pollin interfaceIThrottleGroups- Parameters:
throttleGroupType- is the throttle group type to update.- Throws:
ManifoldCFException
-
poll
public void poll() throws ManifoldCFExceptionPoll periodically, to update ALL cluster-wide statistics and allocation.- Specified by:
pollin interfaceIThrottleGroups- Throws:
ManifoldCFException
-
freeUnusedResources
public void freeUnusedResources() throws ManifoldCFExceptionFree unused resources.- Specified by:
freeUnusedResourcesin interfaceIThrottleGroups- Throws:
ManifoldCFException
-
destroy
public void destroy() throws ManifoldCFExceptionShut down throttler permanently.- Specified by:
destroyin interfaceIThrottleGroups- Throws:
ManifoldCFException
-
-