Class 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.
    • 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • threadContext

        protected final IThreadContext threadContext
        The thread context
      • throttler

        protected static final Throttler throttler
        The actual static pool
    • 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 interface IThrottleGroups
        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 interface IThrottleGroups
        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 interface IThrottleGroups
        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 interface IThrottleGroups
        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 interface IThrottleGroups
        Parameters:
        throttleGroupType - is the throttle group type to update.
        Throws:
        ManifoldCFException