manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1550934 - in /manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core: interfaces/ system/ throttler/
Date Sat, 14 Dec 2013 13:48:43 GMT
Author: kwright
Date: Sat Dec 14 13:48:43 2013
New Revision: 1550934

URL: http://svn.apache.org/r1550934
Log:
Reorganize the throttler api so that we only need to find the throttlegroup once.

Added:
    manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IThrottleGroups.java
      - copied, changed from r1550906, manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IConnectionThrottler.java
    manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ThrottleGroupsFactory.java
      - copied, changed from r1550329, manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ConnectionThrottlerFactory.java
    manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/throttler/ThrottleGroups.java
      - copied, changed from r1550906, manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/throttler/ConnectionThrottler.java
Removed:
    manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ConnectionThrottlerFactory.java
    manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/throttler/ConnectionThrottler.java
Modified:
    manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IConnectionThrottler.java
    manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java
    manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/throttler/Throttler.java

Modified: manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IConnectionThrottler.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IConnectionThrottler.java?rev=1550934&r1=1550933&r2=1550934&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IConnectionThrottler.java
(original)
+++ manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IConnectionThrottler.java
Sat Dec 14 13:48:43 2013
@@ -20,88 +20,34 @@ package org.apache.manifoldcf.core.inter
 
 import java.util.*;
 
-/** An IConnectionThrottler object is thread-local and creates a virtual pool
-* of connections to resources whose access needs to be throttled in number, 
-* rate of use, and byte rate.
+/** An IConnectionThrottler object is not thread-local.  It gates connection
+* creation.
 */
 public interface IConnectionThrottler
 {
   public static final String _rcsid = "@(#)$Id$";
 
-  /** 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.
-  *@param throttleGroupType is the throttle group type.
-  *@return the set of throttle groups for that group type.
-  */
-  public Set<String> getThrottleGroups(String throttleGroupType)
-    throws ManifoldCFException;
-  
-  /** Remove a throttle group.
-  *@param throttleGroupType is the throttle group type.
-  *@param throttleGroup is the throttle group.
-  */
-  public void removeThrottleGroup(String throttleGroupType, String throttleGroup)
-    throws ManifoldCFException;
-  
-  /** Set or update throttle specification for a throttle group.  This creates the
-  * throttle group if it does not yet exist.
-  *@param throttleGroupType is the throttle group type.
-  *@param throttleGroup is the throttle group.
-  *@param throttleSpec is the desired throttle specification object.
-  */
-  public void updateThrottleSpecification(String throttleGroupType, String throttleGroup,
IThrottleSpec throttleSpec)
-    throws ManifoldCFException;
-
   /** Get permission to use a connection, which is described by the passed array of bin names.
   * This method may block until a connection slot is available.
   * The connection can be used multiple times until the releaseConnectionPermission() method
is called.
   * This persistence feature is meant to allow connections to be pooled locally by the caller.
-  *@param throttleGroupType is the throttle group type.
-  *@param throttleGroup is the throttle group.
-  *@param binNames is the set of bin names to throttle for, within the throttle group.
   *@return the fetch throttler to use when performing fetches from the corresponding connection,
or null if the system is being shut down.
   */
-  public IFetchThrottler obtainConnectionPermission(String throttleGroupType , String throttleGroup,
-    String[] binNames)
-    throws ManifoldCFException;
+  public IFetchThrottler obtainConnectionPermission()
+    throws InterruptedException;
   
   /** Determine whether to release a pooled connection.  This method returns the number of
bins
   * where the outstanding connection exceeds current quotas, indicating whether at least
one with the specified
   * characteristics should be released.
   * NOTE WELL: This method cannot judge which is the best connection to be released to meet
   * quotas.  The caller needs to do that based on the highest number of bins matched.
-  *@param throttleGroupType is the throttle group type.
-  *@param throttleGroup is the throttle group.
-  *@param binNames is the set of bin names to throttle for, within the throttle group.
   *@return the number of bins that are over quota, or zero if none of them are.
   */
-  public int overConnectionQuotaCount(String throttleGroupType, String throttleGroup, String[]
binNames)
-    throws ManifoldCFException;
+  public int overConnectionQuotaCount();
   
   /** Release permission to use one connection. This presumes that obtainConnectionPermission()
   * was called earlier by someone and was successful.
-  *@param throttleGroupType is the throttle group type.
-  *@param throttleGroup is the throttle group.
-  *@param binNames is the set of bin names to throttle for, within the throttle group.
   */
-  public void releaseConnectionPermission(String throttleGroupType, String throttleGroup,
String[] binNames)
-    throws ManifoldCFException;
+  public void releaseConnectionPermission();
   
-  /** Poll periodically, to update cluster-wide statistics and allocation.
-  *@param throttleGroupType is the throttle group type to update.
-  */
-  public void poll(String throttleGroupType)
-    throws ManifoldCFException;
-  
-  /** Free unused resources.
-  */
-  public void freeUnusedResources()
-    throws ManifoldCFException;
-  
-  /** Shut down throttler permanently.
-  */
-  public void destroy()
-    throws ManifoldCFException;
-
 }

Copied: manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IThrottleGroups.java
(from r1550906, manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IConnectionThrottler.java)
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IThrottleGroups.java?p2=manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IThrottleGroups.java&p1=manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IConnectionThrottler.java&r1=1550906&r2=1550934&rev=1550934&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IConnectionThrottler.java
(original)
+++ manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IThrottleGroups.java
Sat Dec 14 13:48:43 2013
@@ -20,11 +20,11 @@ package org.apache.manifoldcf.core.inter
 
 import java.util.*;
 
-/** An IConnectionThrottler object is thread-local and creates a virtual pool
+/** An IThrottleGroups object is thread-local and creates a virtual pool
 * of connections to resources whose access needs to be throttled in number, 
 * rate of use, and byte rate.
 */
-public interface IConnectionThrottler
+public interface IThrottleGroups
 {
   public static final String _rcsid = "@(#)$Id$";
 
@@ -44,49 +44,22 @@ public interface IConnectionThrottler
   public void removeThrottleGroup(String throttleGroupType, String throttleGroup)
     throws ManifoldCFException;
   
-  /** Set or update throttle specification for a throttle group.  This creates the
-  * throttle group if it does not yet exist.
+  /** Create or update a throttle group.
   *@param throttleGroupType is the throttle group type.
   *@param throttleGroup is the throttle group.
   *@param throttleSpec is the desired throttle specification object.
   */
-  public void updateThrottleSpecification(String throttleGroupType, String throttleGroup,
IThrottleSpec throttleSpec)
+  public void createOrUpdateThrottleGroup(String throttleGroupType, String throttleGroup,
IThrottleSpec throttleSpec)
     throws ManifoldCFException;
 
-  /** Get permission to use a connection, which is described by the passed array of bin names.
-  * This method may block until a connection slot is available.
-  * The connection can be used multiple times until the releaseConnectionPermission() method
is called.
-  * This persistence feature is meant to allow connections to be pooled locally by the caller.
+  /** 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.
   *@param throttleGroupType is the throttle group type.
   *@param throttleGroup is the throttle group.
-  *@param binNames is the set of bin names to throttle for, within the throttle group.
-  *@return the fetch throttler to use when performing fetches from the corresponding connection,
or null if the system is being shut down.
+  *@param binNames are the connection type bin names.
+  *@return the connection throttling object, or null if the pool is being shut down.
   */
-  public IFetchThrottler obtainConnectionPermission(String throttleGroupType , String throttleGroup,
-    String[] binNames)
-    throws ManifoldCFException;
-  
-  /** Determine whether to release a pooled connection.  This method returns the number of
bins
-  * where the outstanding connection exceeds current quotas, indicating whether at least
one with the specified
-  * characteristics should be released.
-  * NOTE WELL: This method cannot judge which is the best connection to be released to meet
-  * quotas.  The caller needs to do that based on the highest number of bins matched.
-  *@param throttleGroupType is the throttle group type.
-  *@param throttleGroup is the throttle group.
-  *@param binNames is the set of bin names to throttle for, within the throttle group.
-  *@return the number of bins that are over quota, or zero if none of them are.
-  */
-  public int overConnectionQuotaCount(String throttleGroupType, String throttleGroup, String[]
binNames)
-    throws ManifoldCFException;
-  
-  /** Release permission to use one connection. This presumes that obtainConnectionPermission()
-  * was called earlier by someone and was successful.
-  *@param throttleGroupType is the throttle group type.
-  *@param throttleGroup is the throttle group.
-  *@param binNames is the set of bin names to throttle for, within the throttle group.
-  */
-  public void releaseConnectionPermission(String throttleGroupType, String throttleGroup,
String[] binNames)
-    throws ManifoldCFException;
+  public IConnectionThrottler obtainConnectionThrottler(String throttleGroupType, String
throttleGroup, String[] binNames);
   
   /** Poll periodically, to update cluster-wide statistics and allocation.
   *@param throttleGroupType is the throttle group type to update.
@@ -94,7 +67,7 @@ public interface IConnectionThrottler
   public void poll(String throttleGroupType)
     throws ManifoldCFException;
   
-  /** Free unused resources.
+  /** Free all unused resources.
   */
   public void freeUnusedResources()
     throws ManifoldCFException;

Copied: manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ThrottleGroupsFactory.java
(from r1550329, manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ConnectionThrottlerFactory.java)
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ThrottleGroupsFactory.java?p2=manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ThrottleGroupsFactory.java&p1=manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ConnectionThrottlerFactory.java&r1=1550329&r2=1550934&rev=1550934&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ConnectionThrottlerFactory.java
(original)
+++ manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ThrottleGroupsFactory.java
Sat Dec 14 13:48:43 2013
@@ -18,16 +18,16 @@
 */
 package org.apache.manifoldcf.core.interfaces;
 
-/** Thread-local IConnectionThrottle factory.
+/** Thread-local IThrottleGroups factory.
 */
-public class ConnectionThrottlerFactory
+public class ThrottleGroupsFactory
 {
   public static final String _rcsid = "@(#)$Id$";
 
   // name to use in thread context pool of objects
-  private final static String objectName = "_ConnectionThrottler_";
+  private final static String objectName = "_ThrottleGroups_";
 
-  private ConnectionThrottlerFactory()
+  private ThrottleGroupsFactory()
   {
   }
 
@@ -35,16 +35,16 @@ public class ConnectionThrottlerFactory
   *@param tc is the thread context.
   *@return the handle.
   */
-  public static IConnectionThrottler make(IThreadContext tc)
+  public static IThrottleGroups make(IThreadContext tc)
     throws ManifoldCFException
   {
     Object o = tc.get(objectName);
-    if (o == null || !(o instanceof IConnectionThrottler))
+    if (o == null || !(o instanceof IThrottleGroups))
     {
-      o = new org.apache.manifoldcf.core.throttler.ConnectionThrottler(tc);
+      o = new org.apache.manifoldcf.core.throttler.ThrottleGroups(tc);
       tc.save(objectName,o);
     }
-    return (IConnectionThrottler)o;
+    return (IThrottleGroups)o;
   }
 
 }

Modified: manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java?rev=1550934&r1=1550933&r2=1550934&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java
(original)
+++ manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/system/ManifoldCF.java
Sat Dec 14 13:48:43 2013
@@ -1396,7 +1396,7 @@ public class ManifoldCF
     public void doCleanup(IThreadContext threadContext)
       throws ManifoldCFException
     {
-      IConnectionThrottler connectionThrottler = ConnectionThrottlerFactory.make(threadContext);
+      IThrottleGroups connectionThrottler = ThrottleGroupsFactory.make(threadContext);
       connectionThrottler.destroy();
     }
     

Copied: manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/throttler/ThrottleGroups.java
(from r1550906, manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/throttler/ConnectionThrottler.java)
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/throttler/ThrottleGroups.java?p2=manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/throttler/ThrottleGroups.java&p1=manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/throttler/ConnectionThrottler.java&r1=1550906&r2=1550934&rev=1550934&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/throttler/ConnectionThrottler.java
(original)
+++ manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/throttler/ThrottleGroups.java
Sat Dec 14 13:48:43 2013
@@ -21,11 +21,11 @@ package org.apache.manifoldcf.core.throt
 import org.apache.manifoldcf.core.interfaces.*;
 import java.util.*;
 
-/** An implementation of IConnectionThrottler, which establishes a JVM-wide
+/** 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.
 */
-public class ConnectionThrottler implements IConnectionThrottler
+public class ThrottleGroups implements IThrottleGroups
 {
   public static final String _rcsid = "@(#)$Id$";
 
@@ -36,7 +36,7 @@ public class ConnectionThrottler impleme
   protected final static Throttler throttler = new Throttler();
   
   /** Constructor */
-  public ConnectionThrottler(IThreadContext threadContext)
+  public ThrottleGroups(IThreadContext threadContext)
     throws ManifoldCFException
   {
     this.threadContext = threadContext;
@@ -73,66 +73,25 @@ public class ConnectionThrottler impleme
   *@param throttleSpec is the desired throttle specification object.
   */
   @Override
-  public void updateThrottleSpecification(String throttleGroupType, String throttleGroup,
IThrottleSpec throttleSpec)
+  public void createOrUpdateThrottleGroup(String throttleGroupType, String throttleGroup,
IThrottleSpec throttleSpec)
     throws ManifoldCFException
   {
-    throttler.updateThrottleSpecification(threadContext, throttleGroupType, throttleGroup,
throttleSpec);
+    throttler.createOrUpdateThrottleGroup(threadContext, throttleGroupType, throttleGroup,
throttleSpec);
   }
 
-  /** Get permission to use a connection, which is described by the passed array of bin names.
-  * This method may block until a connection slot is available.
-  * The connection can be used multiple times until the releaseConnectionPermission() method
is called.
-  * This persistence feature is meant to allow connections to be pooled locally by the caller.
+  /** 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.
   *@param throttleGroupType is the throttle group type.
   *@param throttleGroup is the throttle group.
-  *@param binNames is the set of bin names to throttle for, within the throttle group.
-  *@return the fetch throttler to use when performing fetches from the corresponding connection,
or null if the system is being shut down.
+  *@param binNames are the connection type bin names.
+  *@return the connection throttling object, or null if the pool is being shut down.
   */
   @Override
-  public IFetchThrottler obtainConnectionPermission(String throttleGroupType , String throttleGroup,
-    String[] binNames)
-    throws ManifoldCFException
-  {
-    try
-    {
-      return throttler.obtainConnectionPermission(throttleGroupType, throttleGroup, binNames);
-    }
-    catch (InterruptedException e)
-    {
-      throw new ManifoldCFException(e.getMessage(),ManifoldCFException.INTERRUPTED);
-    }
-  }
-  
-  /** Determine whether to release a pooled connection.  This method returns the number of
bins
-  * where the outstanding connection exceeds current quotas, indicating whether at least
one with the specified
-  * characteristics should be released.
-  * NOTE WELL: This method cannot judge which is the best connection to be released to meet
-  * quotas.  The caller needs to do that based on the highest number of bins matched.
-  *@param throttleGroupType is the throttle group type.
-  *@param throttleGroup is the throttle group.
-  *@param binNames is the set of bin names to throttle for, within the throttle group.
-  *@return the number of bins that are over quota, or zero if none of them are.
-  */
-  @Override
-  public int overConnectionQuotaCount(String throttleGroupType, String throttleGroup, String[]
binNames)
-    throws ManifoldCFException
+  public IConnectionThrottler obtainConnectionThrottler(String throttleGroupType, String
throttleGroup, String[] binNames)
   {
-    return throttler.overConnectionQuotaCount(throttleGroupType, throttleGroup, binNames);
+    return throttler.obtainConnectionThrottler(throttleGroupType, throttleGroup, binNames);
   }
-  
-  /** Release permission to use one connection. This presumes that obtainConnectionPermission()
-  * was called earlier by someone and was successful.
-  *@param throttleGroupType is the throttle group type.
-  *@param throttleGroup is the throttle group.
-  *@param binNames is the set of bin names to throttle for, within the throttle group.
-  */
-  @Override
-  public void releaseConnectionPermission(String throttleGroupType, String throttleGroup,
String[] binNames)
-    throws ManifoldCFException
-  {
-    throttler.releaseConnectionPermission(throttleGroupType, throttleGroup, binNames);
-  }
-  
+
   /** Poll periodically, to update cluster-wide statistics and allocation.
   *@param throttleGroupType is the throttle group type to update.
   */

Modified: manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/throttler/Throttler.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/throttler/Throttler.java?rev=1550934&r1=1550933&r2=1550934&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/throttler/Throttler.java
(original)
+++ manifoldcf/branches/CONNECTORS-829/framework/core/src/main/java/org/apache/manifoldcf/core/throttler/Throttler.java
Sat Dec 14 13:48:43 2013
@@ -102,7 +102,7 @@ public class Throttler
   *@param throttleGroup is the throttle group.
   *@param throttleSpec is the desired throttle specification object.
   */
-  public void updateThrottleSpecification(IThreadContext threadContext, String throttleGroupType,
String throttleGroup, IThrottleSpec throttleSpec)
+  public void createOrUpdateThrottleGroup(IThreadContext threadContext, String throttleGroupType,
String throttleGroup, IThrottleSpec throttleSpec)
     throws ManifoldCFException
   {
     // Potential addition.  Lock the whole hierarchy.
@@ -114,72 +114,21 @@ public class Throttler
         tg = new ThrottlingGroups(throttleGroupType);
         throttleGroupsHash.put(throttleGroupType, tg);
       }
-      tg.updateThrottleSpecification(threadContext, throttleGroup, throttleSpec);
+      tg.createOrUpdateThrottleGroup(threadContext, throttleGroup, throttleSpec);
     }
   }
 
-  /** Get permission to use a connection, which is described by the passed array of bin names.
-  * This method may block until a connection slot is available.
-  * The connection can be used multiple times until the releaseConnectionPermission() method
is called.
-  * This persistence feature is meant to allow connections to be pooled locally by the caller.
+  /** 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.
   *@param throttleGroupType is the throttle group type.
   *@param throttleGroup is the throttle group.
-  *@param binNames is the set of bin names to throttle for, within the throttle group.
-  *@return the fetch throttler to use when performing fetches from the corresponding connection,
or null if the system is being shut down.
+  *@param binNames are the connection type bin names.
+  *@return the connection throttling object, or null if the pool is being shut down.
   */
-  public IFetchThrottler obtainConnectionPermission(String throttleGroupType , String throttleGroup,
-    String[] binNames)
-    throws InterruptedException
+  public IConnectionThrottler obtainConnectionThrottler(String throttleGroupType, String
throttleGroup, String[] binNames)
   {
-    // This method may wait at the innermost level.  We therefore do not lock the hierarchy,
BUT
-    // we must code for the possibility that the hierarchy is fluid, and may dissolve.  Under
such
-    // conditions we could simply retry.  But in this case, the hierarchy has state: there
is an
-    // explicit creation step (updateThrottleSpecification) that must be called to establish
the
-    // innermost object and set it up correctly.  It is therefore meaningful if we do not
find
-    // the expected structure: we return null in that case.
-    ThrottlingGroups tg;
-    synchronized (throttleGroupsHash)
-    {
-      tg = throttleGroupsHash.get(throttleGroupType);
-    }
-    if (tg == null)
-      return null;
-    return tg.obtainConnectionPermission(throttleGroup, binNames);
-  }
-  
-  /** Determine whether to release a pooled connection.  This method returns the number of
bins
-  * where the outstanding connection exceeds current quotas, indicating whether at least
one with the specified
-  * characteristics should be released.
-  * NOTE WELL: This method cannot judge which is the best connection to be released to meet
-  * quotas.  The caller needs to do that based on the highest number of bins matched.
-  *@param throttleGroupType is the throttle group type.
-  *@param throttleGroup is the throttle group.
-  *@param binNames is the set of bin names to throttle for, within the throttle group.
-  *@return the number of bins that are over quota, or zero if none of them are.
-  */
-  public int overConnectionQuotaCount(String throttleGroupType, String throttleGroup, String[]
binNames)
-  {
-    // No waiting, so it is OK to lock everything.
-    synchronized (throttleGroupsHash)
-    {
-      // MHL
-      return 0;
-    }
-  }
-  
-  /** Release permission to use one connection. This presumes that obtainConnectionPermission()
-  * was called earlier by someone and was successful.
-  *@param throttleGroupType is the throttle group type.
-  *@param throttleGroup is the throttle group.
-  *@param binNames is the set of bin names to throttle for, within the throttle group.
-  */
-  public void releaseConnectionPermission(String throttleGroupType, String throttleGroup,
String[] binNames)
-  {
-    // No waiting, so it is ok to lock the entire tree.
-    synchronized (throttleGroupsHash)
-    {
-      // MHL
-    }
+    // MHL
+    return null;
   }
   
   /** Poll periodically.
@@ -258,7 +207,7 @@ public class Throttler
     // MHL
     
     /** Update throttle specification */
-    public void updateThrottleSpecification(IThreadContext threadContext, String throttleGroup,
IThrottleSpec throttleSpec)
+    public void createOrUpdateThrottleGroup(IThreadContext threadContext, String throttleGroup,
IThrottleSpec throttleSpec)
       throws ManifoldCFException
     {
       synchronized (groups)



Mime
View raw message