|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.glassfish.grizzly.filterchain.FilterAdapter
org.glassfish.grizzly.rcm.ResourceAllocationFilter
public class ResourceAllocationFilter
This ProtocolFilter is an implementation of a Resource Consumption Management
(RCM) system. RCM system are allowing you to enable virtualization of system
resources per web application, similar to Solaris 10 Zone or the outcome of
the upcoming JSR 284.
This ProtocolFiler uses a ProtocolParser to determine which
token to use to enable virtualization. As an example, configuring this class
to use the ContextRootAlgorithm will allow virtualization
and isolation of http request. As an example, if you define:
-Dcom.sun.grizzly.rcm.policyMetric="/myApplication|0.9"
This ProtocolFilter will allocate 90% of the current threads count to
application myApplication, and the remaining 10% to any other context-root
(or application). See com.sun.grizzly.rcm.RCM for an example.
| Field Summary | |
|---|---|
protected static String |
ALLOCATION_MODE
|
protected static String |
allocationPolicy
The allocation mode used: celling or Reserve. |
protected static String |
CEILING
|
protected static double |
leftRatio
The thread ratio used when an application isn't listed as a privileged application. |
protected static String |
PATH_STRING
|
protected static ConcurrentHashMap<String,Double> |
privilegedTokens
The list of privileged token used to decide if a request can be serviced by the privileged ExecutorService. |
protected static String |
QUERY_STRING
|
protected static String |
RESERVE
|
protected static String |
RULE_TOKENS
|
protected static ConcurrentHashMap<String,ExecutorService> |
threadPools
The ExecutorService configured based on the
threadRatio. |
| Constructor Summary | |
|---|---|
ResourceAllocationFilter()
|
|
| Method Summary | |
|---|---|
ExecutorService |
filterRequest(String token,
ExecutorService p)
Filter the request and decide which thread pool to use. |
protected String |
getContextRoot(String token)
Get the context-root from the StreamReader |
NextAction |
handleRead(FilterChainContext ctx,
NextAction nextAction)
|
protected boolean |
isThreadPoolInUse()
Check to see if the privileged thread pool are in-use right now. |
protected ExecutorService |
newThreadPool(int threadCount,
ExecutorService p)
Creates a new ExecutorService |
protected boolean |
parse(StreamReader reader,
int state,
StringBuilder sb)
|
| Methods inherited from class org.glassfish.grizzly.filterchain.FilterAdapter |
|---|
exceptionOccurred, getFilterChain, getIndex, handleAccept, handleClose, handleConnect, handleWrite, isIndexable, postAccept, postClose, postConnect, postRead, postWrite, setIndex |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final String RESERVE
protected static final String CEILING
protected static final String ALLOCATION_MODE
protected static final String RULE_TOKENS
protected static final String QUERY_STRING
protected static final String PATH_STRING
protected static final ConcurrentHashMap<String,ExecutorService> threadPools
ExecutorService configured based on the
threadRatio. This ExecutorService is only used
by privileged application.
protected static final ConcurrentHashMap<String,Double> privilegedTokens
ExecutorService.
protected static double leftRatio
protected static String allocationPolicy
| Constructor Detail |
|---|
public ResourceAllocationFilter()
| Method Detail |
|---|
public NextAction handleRead(FilterChainContext ctx,
NextAction nextAction)
throws IOException
handleRead in interface FilterhandleRead in class FilterAdapterIOException
public ExecutorService filterRequest(String token,
ExecutorService p)
protected ExecutorService newThreadPool(int threadCount,
ExecutorService p)
ExecutorService
protected boolean isThreadPoolInUse()
protected String getContextRoot(String token)
StreamReader
protected boolean parse(StreamReader reader,
int state,
StringBuilder sb)
throws IOException
IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||