|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.sun.grizzly.filter.ReadFilter
com.sun.grizzly.filter.ParserProtocolFilter
com.sun.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 java.lang.String |
ALLOCATION_MODE
|
protected static java.lang.String |
allocationPolicy
The allocation mode used: celling or Reserve. |
protected static java.lang.String |
ASTERISK_STRING
|
static java.lang.String |
BYTE_BUFFER
|
static java.lang.String |
BYTEBUFFER_INPUTSTREAM
|
protected static java.lang.String |
CEILING
|
static java.lang.String |
INVOKE_NEXT
|
protected static double |
leftRatio
The thread ratio used when an application isn't listed as a privileged application. |
protected static java.lang.String |
PATH_STRING
|
protected static java.util.concurrent.ConcurrentHashMap<java.lang.String,java.lang.Double> |
privilegedTokens
The list of privileged token used to decide if a request can be serviced by the privileged ExecutorService. |
protected static java.lang.String |
QUERY_STRING
|
protected static java.lang.String |
RESERVE
|
protected static java.lang.String |
RULE_TOKENS
|
protected static java.util.concurrent.ConcurrentHashMap<java.lang.String,java.util.concurrent.ExecutorService> |
threadPools
The ExecutorService configured based on the
threadRatio. |
| Fields inherited from class com.sun.grizzly.filter.ParserProtocolFilter |
|---|
isSkipRead |
| Fields inherited from class com.sun.grizzly.filter.ReadFilter |
|---|
continousExecution, DELAYED_CLOSE_NOTIFICATION, readAttempts, UDP_SOCKETADDRESS |
| Fields inherited from interface com.sun.grizzly.ProtocolFilter |
|---|
SUCCESSFUL_READ |
| Constructor Summary | |
|---|---|
ResourceAllocationFilter()
|
|
| Method Summary | |
|---|---|
void |
closeConnection(Context ctx)
Close the connection. |
boolean |
execute(Context ctx)
|
java.util.concurrent.ExecutorService |
filterRequest(java.lang.String token,
java.util.concurrent.ExecutorService p)
Filter the request and decide which thread pool to use. |
protected java.lang.String |
getContextRoot(java.nio.ByteBuffer byteBuffer)
Get the context-root from the ByteBuffer |
boolean |
invokeProtocolParser(Context ctx,
ProtocolParser protocolParser)
Invoke the ProtocolParser. |
protected boolean |
isThreadPoolInUse()
Check to see if the privileged thread pool are in-use right now. |
ProtocolParser |
newProtocolParser()
Return a new ProtocolParser>/code> or a cached |
protected java.util.concurrent.ExecutorService |
newThreadPool(int threadCount,
java.util.concurrent.ExecutorService p)
Creates a new ExecutorService |
| Methods inherited from class com.sun.grizzly.filter.ParserProtocolFilter |
|---|
isSkipRead, postExecute, setSkipRead, setSSLConfig |
| Methods inherited from class com.sun.grizzly.filter.ReadFilter |
|---|
checkEmptyRead, execute, getReadAttempts, isContinuousExecution, log, setContinuousExecution, setReadAttempts |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String BYTE_BUFFER
protected static final java.lang.String RESERVE
protected static final java.lang.String CEILING
protected static final java.lang.String ALLOCATION_MODE
protected static final java.lang.String RULE_TOKENS
protected static final java.lang.String QUERY_STRING
protected static final java.lang.String PATH_STRING
protected static final java.lang.String ASTERISK_STRING
public static final java.lang.String BYTEBUFFER_INPUTSTREAM
public static final java.lang.String INVOKE_NEXT
protected static final java.util.concurrent.ConcurrentHashMap<java.lang.String,java.util.concurrent.ExecutorService> threadPools
ExecutorService configured based on the
threadRatio. This ExecutorService is only used
by privileged application.
protected static final java.util.concurrent.ConcurrentHashMap<java.lang.String,java.lang.Double> privilegedTokens
ExecutorService.
protected static double leftRatio
protected static java.lang.String allocationPolicy
| Constructor Detail |
|---|
public ResourceAllocationFilter()
| Method Detail |
|---|
public boolean execute(Context ctx)
throws java.io.IOException
execute in interface ProtocolFilterexecute in class ParserProtocolFilterjava.io.IOException
public boolean invokeProtocolParser(Context ctx,
ProtocolParser protocolParser)
ProtocolParser. If more bytes are required,
register the SelectionKey back to its associated
SelectorHandler
invokeProtocolParser in class ParserProtocolFilterctx - the Context object.
public java.util.concurrent.ExecutorService filterRequest(java.lang.String token,
java.util.concurrent.ExecutorService p)
protected java.util.concurrent.ExecutorService newThreadPool(int threadCount,
java.util.concurrent.ExecutorService p)
ExecutorService
protected boolean isThreadPoolInUse()
protected java.lang.String getContextRoot(java.nio.ByteBuffer byteBuffer)
ByteBuffer
public void closeConnection(Context ctx)
public ProtocolParser newProtocolParser()
ProtocolParser>/code> or a cached
- Specified by:
newProtocolParser in class ParserProtocolFilter
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||