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
_rcsid
protected IThreadContext
threadContext
The thread contextprotected static Throttler
throttler
The 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 void
createOrUpdateThrottleGroup(java.lang.String throttleGroupType, java.lang.String throttleGroup, IThrottleSpec throttleSpec)
Set or update throttle specification for a throttle group.void
destroy()
Shut down throttler permanently.void
freeUnusedResources()
Free unused resources.java.util.Set<java.lang.String>
getThrottleGroups(java.lang.String throttleGroupType)
Get all existing throttle groups for a throttle group type.IConnectionThrottler
obtainConnectionThrottler(java.lang.String throttleGroupType, java.lang.String throttleGroup, java.lang.String[] binNames)
Construct connection throttler for connections with specific bin names.void
poll()
Poll periodically, to update ALL cluster-wide statistics and allocation.void
poll(java.lang.String throttleGroupType)
Poll periodically, to update cluster-wide statistics and allocation.void
removeThrottleGroup(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 ManifoldCFException
Get 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:
getThrottleGroups
in 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 ManifoldCFException
Remove a throttle group.- Specified by:
removeThrottleGroup
in 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 ManifoldCFException
Set or update throttle specification for a throttle group. This creates the throttle group if it does not yet exist.- Specified by:
createOrUpdateThrottleGroup
in 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:
obtainConnectionThrottler
in 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 ManifoldCFException
Poll periodically, to update cluster-wide statistics and allocation.- Specified by:
poll
in interfaceIThrottleGroups
- Parameters:
throttleGroupType
- is the throttle group type to update.- Throws:
ManifoldCFException
-
poll
public void poll() throws ManifoldCFException
Poll periodically, to update ALL cluster-wide statistics and allocation.- Specified by:
poll
in interfaceIThrottleGroups
- Throws:
ManifoldCFException
-
freeUnusedResources
public void freeUnusedResources() throws ManifoldCFException
Free unused resources.- Specified by:
freeUnusedResources
in interfaceIThrottleGroups
- Throws:
ManifoldCFException
-
destroy
public void destroy() throws ManifoldCFException
Shut down throttler permanently.- Specified by:
destroy
in interfaceIThrottleGroups
- Throws:
ManifoldCFException
-
-