org.apache.cassandra.concurrent
Class StageManager

java.lang.Object
  extended by org.apache.cassandra.concurrent.StageManager

public class StageManager
extends java.lang.Object

This class manages all stages that exist within a process. The application registers and de-registers stages with this abstraction. Any component that has the ID associated with a stage can obtain a handle to actual stage. Author : Avinash Lakshman ( alakshman@facebook.com) & Prashant Malik ( pmalik@facebook.com )


Constructor Summary
StageManager()
           
 
Method Summary
static void deregisterStage(java.lang.String stageName)
          Deregister a stage from StageManager
static IStage getCurrentStage()
          Returns the stage that we are currently executing on.
static IStage getStage(java.lang.String stageName)
          Retrieve a stage from the StageManager
static java.util.concurrent.ExecutorService getStageInternalThreadPool(java.lang.String stageName)
          Retrieve the internal thread pool associated with the specified stage name.
static long getStageTaskCount(java.lang.String stage)
          This method gets the number of tasks on the stage's internal queue.
static void registerStage(java.lang.String stageName, IStage stage)
          Register a stage with the StageManager
static void shutdown()
          This method shuts down all registered stages.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StageManager

public StageManager()
Method Detail

registerStage

public static void registerStage(java.lang.String stageName,
                                 IStage stage)
Register a stage with the StageManager

Parameters:
stageName - stage name.
stage - stage for the respective message types.

getCurrentStage

public static IStage getCurrentStage()
Returns the stage that we are currently executing on. This relies on the fact that the thread names in the stage have the name of the stage as the prefix.

Returns:
Returns the stage that we are currently executing on.

getStage

public static IStage getStage(java.lang.String stageName)
Retrieve a stage from the StageManager

Parameters:
stageName - name of the stage to be retrieved.

getStageInternalThreadPool

public static java.util.concurrent.ExecutorService getStageInternalThreadPool(java.lang.String stageName)
Retrieve the internal thread pool associated with the specified stage name.

Parameters:
stageName - name of the stage.

deregisterStage

public static void deregisterStage(java.lang.String stageName)
Deregister a stage from StageManager

Parameters:
stageName - stage name.

getStageTaskCount

public static long getStageTaskCount(java.lang.String stage)
This method gets the number of tasks on the stage's internal queue.

Parameters:
stage - name of the stage
Returns:
stage task count.

shutdown

public static void shutdown()
This method shuts down all registered stages.



Copyright © 2009 The Apache Software Foundation