|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.grizzly.http.SelectorThread
public class SelectorThread
The SelectorThread class is the entry point when embedding the Grizzly Web
Server. All Web Server configuration must be set on this object before invoking
the listen()
method. As an example:
final SelectorThread selectorThread = new SelectorThread(){
public void listen() throws IOException, InstantiationException{
super.listen();
System.out.println("Server started in " + (System.currentTimeMillis() - t1)
+ " milliseconds.");
}
};
selectorThread.setAlgorithmClassName(StaticStreamAlgorithm.class.getName());
selectorThread.setPort(port);
selectorThread.setWebAppRootPath(folder);
Adapter adapter = new StaticResourcesAdapter(folder);
((StaticResourcesAdapter)adapter).setRootFolder(folder);
selectorThread.setAdapter(adapter);
selectorThread.setDisplayConfiguration(true);
selectorThread.listen();
Field Summary | |
---|---|
protected Queue<ProcessorTask> |
activeProcessorTasks
List of active ProcessorTask . |
protected Adapter |
adapter
Associated adapter. |
protected Class |
algorithmClass
The StreamAlgorithm used to predict the end of the NIO stream |
protected String |
algorithmClassName
The StreamAlgorithm used to parse the NIO stream. |
protected boolean |
asyncExecution
Is asynchronous mode enabled? |
protected AsyncHandler |
asyncHandler
When the asynchronous mode is enabled, the execution of this object will be delegated to the AsyncHandler |
protected boolean |
bufferResponse
Buffer the response until the buffer is full. |
protected String |
compressableMimeTypes
|
protected String |
compression
Compression value. |
protected int |
compressionMinSize
|
protected Controller |
controller
The Grizzly's Controller. |
static String |
DEFAULT_ALGORITHM
The default NIO stream algorithm. |
protected static boolean |
defaultAlgorithmInstalled
Is the DEFAULT_ALGORITHM used. |
protected String |
defaultResponseType
The default response-type |
protected boolean |
disableUploadTimeout
Flag to disable setting a different time-out on uploads. |
protected boolean |
displayConfiguration
If true, display the NIO configuration information. |
protected String |
domain
|
protected static boolean |
enableNioLogging
Grizzly own debug flag. |
protected FileCacheFactory |
fileCacheFactory
The FileCacheFactory associated with this Selector |
protected String |
forcedRequestType
The forced request-type |
protected boolean |
forceKeepAlive
|
protected RequestGroupInfo |
globalRequestProcessor
Monitoring object used to store information. |
protected ObjectName |
globalRequestProcessorName
|
protected InetAddress |
inet
|
protected boolean |
initialized
|
protected boolean |
isAsyncHttpWriteEnabled
Is Async HTTP write enabled. |
protected boolean |
isFileCacheEnabled
Is the FileCache enabled. |
protected boolean |
isLargeFileCacheEnabled
Is the large FileCache enabled. |
protected boolean |
isMonitoringEnabled
Is monitoring already started. |
protected KeepAliveStats |
keepAliveStats
Keep-alive stats |
protected int |
keepAliveThreadCount
|
protected int |
linger
|
protected static Logger |
logger
The logger used by the grizzly classes. |
protected int |
maxCacheEntries
The maximum entries in the FileCache |
protected long |
maxEntrySize
The maximum size of a cached resources. |
protected int |
maxHttpHeaderSize
Default HTTP header buffer size. |
protected long |
maxLargeFileCacheSize
The maximum cached bytes |
protected int |
maxPostSize
|
protected long |
maxSmallFileCacheSize
The maximum cached bytes |
protected long |
minEntrySize
The maximum size of a cached resources. |
protected MBeanServer |
mserver
|
protected String |
noCompressionUserAgents
|
protected ObjectName |
oname
|
protected boolean |
oOBInline
|
protected int |
port
|
protected PUReadFilter |
portUnificationFilter
Port unification filter |
protected ProcessorTaskFactory |
processorTaskFactory
|
protected Queue<ProcessorTask> |
processorTasks
Queue used as an object pool. |
protected ObjectName |
processorWorkerThreadName
|
protected HashMap<String,Object> |
properties
Holder for our configured properties. |
protected boolean |
rcmSupport
RCM support |
protected int |
readThreadsCount
The number of read threads. |
protected int |
requestBufferSize
The input request buffer size. |
protected String |
restrictedUserAgents
|
protected String |
rootFolder
The root folder where application are deployed |
protected AtomicBoolean |
running
|
protected int |
secondsMaxAge
Timeout before remove the static resource from the cache. |
protected Selector |
selector
The Selector used by the connector. |
protected TCPSelectorHandler |
selectorHandler
SelectorHandler current SelectorThread is
based on |
protected static ConcurrentHashMap<Integer,SelectorThread> |
selectorThreads
Static list of current instance of this class. |
protected int |
selectorTimeout
The Selector timeout value. |
static String |
SERVER_NAME
|
protected int |
serverTimeout
|
protected static StringManager |
sm
The string manager for this package. |
protected int |
socketTimeout
|
protected int |
ssBackLog
Server socket backlog. |
protected boolean |
tcpNoDelay
|
protected ExecutorService |
threadPool
The queue shared by this thread and the code>ProcessorTask. |
protected ThreadPoolStatistic |
threadPoolStat
Placeholder for ExecutorService statistic. |
protected int |
transactionTimeout
The timeout used by the thread when processing a request. |
protected int |
uploadTimeout
Maximum timeout on uploads. |
protected boolean |
useByteBufferView
Create view ByteBuffer from another ByteBuffer |
protected boolean |
useDirectByteBuffer
Is the ByteBuffer used by the ReadTask use
direct ByteBuffer or not. |
Constructor Summary | |
---|---|
SelectorThread()
Create the Selector object. |
Method Summary | |
---|---|
void |
addAsyncEnabledContextPath(String s)
Add a context-path that will be allowed to execute using the AsyncHandler . |
void |
cancelKey(SelectionKey key)
Cancel the current SelectionKey |
protected void |
clearTasks()
Clear all cached Tasks |
protected void |
configureCompression(ProcessorTask processorTask)
|
protected void |
configureFileCacheFactory()
|
protected void |
configureFilters(ProtocolChain protocolChain)
Adds and configures ProtocolChain 's filters |
void |
configurePortUnification(List<ProtocolFinder> protocolFinders,
List<ProtocolHandler> protocolHandlers,
List<PUPreProcessor> preProcessors)
Configures port unification depending on passed List s |
void |
configurePortUnification(Properties props)
Configures port unification depending on passed Properties |
protected ProcessorTask |
configureProcessorTask(ProcessorTask task)
|
protected void |
configureProtocolChain()
Configure SelectorThread ProtocolChain |
protected void |
configureSelectorHandler(TCPSelectorHandler selectorHandler)
Configure TCPSelectorHandler |
protected FileCacheFactory |
createFileCacheFactory()
|
protected ProtocolFilter |
createHttpParserFilter()
Create HTTP parser ProtocolFilter |
protected KeepAliveStats |
createKeepAliveStats()
|
protected ProtocolFilter |
createRaFilter()
Create and configure resource allocation ProtocolFilter |
protected SelectorThreadKeyHandler |
createSelectionKeyHandler()
Create SelectorThreadKeyHandler |
protected TCPSelectorHandler |
createSelectorHandler()
Create TCPSelectorHandler |
void |
disableMonitoring()
Disable gathering of monitoring data. |
protected void |
disableThreadPoolStats()
Removes ThreadPoolStatistic from every
ExecutorService , when monitoring has been turned off. |
void |
enableMonitoring()
Enable gathering of monitoring data. |
void |
enableRcmSupport(boolean rcmSupport)
Enable Application Resource Allocation Grizzly Extension. |
protected void |
enableThreadPoolStats()
Injects ThreadPoolStatistic into every
ExecutorService , for monitoring purposes. |
Queue<ProcessorTask> |
getActiveProcessorTasks()
|
Adapter |
getAdapter()
Get the associated adapter. |
InetAddress |
getAddress()
|
String |
getAlgorithmClassName()
|
AsyncHandler |
getAsyncHandler()
Return the AsyncHandler used when asynchronous execution is
enabled. |
boolean |
getBufferResponse()
Return true if the reponse is buffered. |
int |
getBufferSize()
Return the request input buffer size |
ClassLoader |
getClassLoader()
|
String |
getCompressableMimeTypes()
|
String |
getCompression()
|
int |
getCompressionMinSize()
|
Controller |
getController()
|
int |
getCoreThreads()
|
String |
getDefaultResponseType()
|
boolean |
getDisableUploadTimeout()
Get the flag that controls upload time-outs. |
String |
getDomain()
|
boolean |
getEnableAsyncExecution()
Return true when asynchronous execution is enabled. |
String |
getForcedRequestType()
|
boolean |
getForceKeepAlive()
Is keep-alive forced? |
InetAddress |
getInet()
|
KeepAliveStats |
getKeepAliveStats()
|
int |
getKeepAliveTimeoutInSeconds()
Gets the number of seconds before a keep-alive connection that has been idle times out and is closed. |
boolean |
getLargeFileCacheEnabled()
Is the large file cache support enabled. |
int |
getLinger()
|
Management |
getManagement()
Return the Management interface, or null if JMX management is
no enabled. |
int |
getMaxCacheEntries()
Return the maximum entries this cache can contains. |
long |
getMaxEntrySize()
Get the maximum size a FileCache.FileCacheEntry can have. |
int |
getMaxHttpHeaderSize()
|
int |
getMaxKeepAliveRequests()
|
long |
getMaxLargeCacheSize()
Get the maximum cache size |
int |
getMaxPostSize()
|
long |
getMaxSmallCacheSize()
Get the maximum cache size |
int |
getMaxThreads()
|
long |
getMinEntrySize()
Get the maximum size a FileCache.FileCacheEntry can have. |
String |
getNoCompressionUserAgents()
|
ObjectName |
getObjectName()
|
int |
getPort()
|
int |
getPortLowLevel()
Deprecated. - uses getPort() instead |
ProcessorTask |
getProcessorTask()
Return a ProcessorTask from the pool. |
ProcessorTaskFactory |
getProcessorTaskFactory()
Get ProcessorTaskFactory . |
Object |
getProperty(String name)
Return a configured property. |
ProtocolChain |
getProtocolChain()
Return thr ProtocolChain used by this instance. |
RequestGroupInfo |
getRequestGroupInfo()
|
String |
getRestrictedUserAgents()
|
boolean |
getReuseAddress()
|
Selector |
getSelector()
Deprecated. To get the right Selector , please request context associated SelectorHandler: SelectorHandler.getSelector() |
static SelectorThread |
getSelector(InetAddress address,
int port)
|
static SelectorThread |
getSelector(int port)
Deprecated. This method is not safe when a machine with multiple listeners are bound to different addresses using the same port. Use getSelector(java.net.InetAddress, int) . |
TCPSelectorHandler |
getSelectorHandler()
Deprecated. use SelectorHandler , which is usually provided by
the current Context . |
int |
getSelectorReadThreadsCount()
|
static Enumeration<SelectorThread> |
getSelectors()
Return an Enumeration of the active
SelectorThread s |
SelectorThreadKeyHandler |
getSelectorThreadKeyHandler()
|
int |
getSelectorTimeout()
|
int |
getSendBufferSize()
|
int |
getServerTimeout()
|
int |
getSocketTimeout()
|
int |
getSsBackLog()
|
boolean |
getTcpNoDelay()
|
ExecutorService |
getThreadPool()
|
String |
getThreadPoolClassname()
|
int |
getTransactionTimeout()
Set the maximum time, in milliseconds, a WorkerThread executing
an instance of this class can execute. |
int |
getUploadTimeout()
Get the upload timeout. |
String |
getWebAppRootPath()
Return the folder's root where application are deployed. |
protected void |
initAlgorithm()
Load using reflection the StreamAlgorithm class. |
protected void |
initController()
Initialize the Grizzly Framework classes. |
void |
initEndpoint()
initialized the endpoint by creating the ServerScoketChannel
and by initializing the server socket. |
protected void |
initFileCacheFactory()
Initialize the FileCacheFactory associated with this instance |
protected void |
initMonitoringLevel()
Initialize the ThreadPoolStatistic instance. |
protected void |
initProcessorTask(int size)
Create a pool of ProcessorTask |
void |
initThreadPool()
Init the StatsThreadPool s used by the WorkerThread s. |
boolean |
isAsyncHttpWriteEnabled()
Is async HTTP write enabled |
static boolean |
isEnableNioLogging()
|
boolean |
isFileCacheEnabled()
Is the fileCache enabled. |
boolean |
isMonitoringEnabled()
Returns true if monitoring has been enabled, false otherwise. |
boolean |
isRcmSupported()
Returns whether Application Resource Allocation Grizzly Extension is supported |
boolean |
isRunning()
|
boolean |
isUseByteBufferView()
|
boolean |
isUseChunking()
Is chunking encoding used. |
boolean |
isUseDirectByteBuffer()
|
void |
listen()
Start the SelectorThread using its own thread and don't block the Thread. |
static Logger |
logger()
Return the logger used by the Grizzly classes. |
protected ProcessorTask |
newProcessorTask(boolean initialize)
Create ProcessorTask objects and configure it to be ready
to proceed request. |
protected ExecutorService |
newThreadPool(int maxQueueSize,
String name,
int port,
int priority)
Create a new StatsThreadPool instance. |
void |
postDeregister()
|
void |
postRegister(Boolean registrationDone)
|
void |
preDeregister()
|
ObjectName |
preRegister(MBeanServer server,
ObjectName name)
|
String |
protocol()
Return the protocol supported by this GrizzlyListener |
protected void |
rampUpProcessorTask()
Initialize ProcessorTask |
protected void |
reconfigureAdapter()
|
protected void |
reconfigureAsyncExecution()
Reconfigure Grizzly Asynchronous Request Processing(ARP) internal objects. |
void |
registerComponents()
Register JMX components supported by this SelectorThread . |
void |
registerKey(SelectionKey key)
Register a SelectionKey to this Selector
running of this thread. |
void |
removeCacheEntry(String contextPath)
Remove a context path from the FileCache . |
void |
removeProperty(String name)
remove a configured property. |
void |
returnTask(Task task)
Returns the Task object to the pool. |
void |
run()
Start the endpoint (this) |
void |
setAdapter(Adapter adapter)
Set the associated adapter. |
void |
setAddress(InetAddress inet)
|
void |
setAlgorithmClassName(String algorithmClassName)
|
void |
setAsyncHandler(AsyncHandler asyncHandler)
Set the AsyncHandler used when asynchronous execution is
enabled. |
void |
setAsyncHttpWriteEnabled(boolean isAsyncHttpWriteEnabled)
Set if async HTTP write enabled |
void |
setBufferResponse(boolean bufferResponse)
trueif the reponse willk be buffered. |
void |
setBufferSize(int requestBufferSize)
Set the request input buffer size |
void |
setClassLoader(ClassLoader classLoader)
Set the ClassLoader used to load configurable
classes (ExecutorService, StreamAlgorithm). |
void |
setCompressableMimeTypes(String compressableMimeTypes)
|
void |
setCompression(String compression)
|
void |
setCompressionMinSize(int compressionMinSize)
|
void |
setController(Controller controller)
|
void |
setCoreThreads(int coreThreads)
|
void |
setDefaultResponseType(String defaultResponseType)
|
void |
setDisableUploadTimeout(boolean isDisabled)
Set the flag to control upload time-outs. |
void |
setDisplayConfiguration(boolean displayConfiguration)
|
void |
setEnableAsyncExecution(boolean asyncExecution)
Enable the AsyncHandler used when asynchronous |
static void |
setEnableNioLogging(boolean enl)
|
void |
setFileCacheIsEnabled(boolean isFileCacheEnabled)
Is the file caching mechanism enabled. |
void |
setForcedRequestType(String forcedRequestType)
|
void |
setForceKeepAlive(boolean forceKeepAlive)
Force keep-alive no mather what the client support. |
void |
setInet(InetAddress inet)
|
void |
setKeepAliveTimeoutInSeconds(int timeout)
Sets the number of seconds before a keep-alive connection that has been idle times out and is closed. |
void |
setLargeFileCacheEnabled(boolean isLargeEnabled)
Is the large file cache support enabled. |
void |
setLinger(int i)
|
static void |
setLogger(Logger l)
Set the logger used by this instance. |
void |
setManagement(Management jmxManagement)
Set the Management interface. |
void |
setMaxCacheEntries(int mEntries)
Set the maximum entries this cache can contains. |
void |
setMaxEntrySize(long mEntrySize)
Set the maximum size a FileCache.FileCacheEntry can have. |
void |
setMaxHttpHeaderSize(int maxHttpHeaderSize)
|
void |
setMaxKeepAliveRequests(int maxKeepAliveRequests)
Set the maximum number of Keep-Alive requests that we will honor. |
void |
setMaxLargeCacheSize(long mCacheSize)
Set the maximum cache size |
void |
setMaxPostSize(int maxPostSize)
|
void |
setMaxSmallCacheSize(long mCacheSize)
Set the maximum cache size |
void |
setMaxThreads(int maxThreads)
|
void |
setMinEntrySize(long mSize)
Set the maximum size a FileCache.FileCacheEntry can have. |
void |
setNoCompressionUserAgents(String noCompressionUserAgents)
|
void |
setPort(int port)
|
void |
setProcessorTaskFactory(ProcessorTaskFactory processorTaskFactory)
Sets ProcessorTaskFactory . |
void |
setProperty(String name,
Object value)
Set a configured property. |
void |
setRestrictedUserAgents(String restrictedUserAgents)
|
void |
setReuseAddress(boolean reuseAddress)
|
void |
setSecondsMaxAge(int sMaxAges)
The timeout in seconds before remove a FileCache.FileCacheEntry
from the FileCache |
void |
setSelectorReadThreadsCount(int readThreadsCount)
|
void |
setSelectorTimeout(int aSelectorTimeout)
|
void |
setSendBufferSize(int sendBufferSize)
|
void |
setServerTimeout(int timeout)
Sets the timeout in ms of the server sockets created by this server. |
protected void |
setSocketOptions(Socket socket)
|
void |
setSocketTimeout(int socketTimeout)
|
void |
setSsBackLog(int ssBackLog)
|
void |
setTcpNoDelay(boolean b)
|
void |
setThreadPool(ExecutorService threadPool)
Set the ExecutorService this class should use. |
void |
setThreadPoolClassname(String threadPoolClassname)
|
void |
setTransactionTimeout(int transactionTimeout)
Set the maximum time, in milliseconds, a WorkerThread processing
an instance of this class. |
void |
setUploadTimeout(int uploadTimeout)
Set the upload timeout. |
void |
setUseByteBufferView(boolean useByteBufferView)
|
void |
setUseChunking(boolean useChunking)
Enable chunking the http response. |
void |
setUseDirectByteBuffer(boolean useDirectByteBuffer)
|
void |
setWebAppRootPath(String rf)
Set the document root folder |
void |
start()
Start using the Controller's internal Thread Pool. |
void |
startEndpoint()
Start the Acceptor Thread and wait for incoming connection, in a non blocking mode. |
protected void |
startListener()
Start a non blocking Selector object. |
protected void |
startThreadPool()
Starts the ExecutorService used by this Selector |
void |
stopEndpoint()
|
protected void |
stopThreadPool()
Stop the ExecutorService used by this Selector |
protected void |
unregisterComponents()
Unregister JMX components supported by this SelectorThread . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String SERVER_NAME
protected int serverTimeout
protected InetAddress inet
protected int port
protected boolean initialized
protected final AtomicBoolean running
protected String domain
protected ObjectName oname
protected ObjectName globalRequestProcessorName
protected MBeanServer mserver
protected ObjectName processorWorkerThreadName
protected boolean tcpNoDelay
protected int linger
protected int socketTimeout
protected int keepAliveThreadCount
protected String compression
protected String noCompressionUserAgents
protected String restrictedUserAgents
protected String compressableMimeTypes
protected int compressionMinSize
protected boolean bufferResponse
protected int maxHttpHeaderSize
protected boolean isAsyncHttpWriteEnabled
protected int maxPostSize
protected Selector selector
Selector
used by the connector.
protected TCPSelectorHandler selectorHandler
SelectorHandler
current SelectorThread
is
based on
protected Adapter adapter
protected ExecutorService threadPool
protected ThreadPoolStatistic threadPoolStat
ExecutorService
statistic.
protected int transactionTimeout
protected boolean useDirectByteBuffer
ByteBuffer
used by the ReadTask
use
direct ByteBuffer
or not.
protected RequestGroupInfo globalRequestProcessor
protected KeepAliveStats keepAliveStats
protected boolean displayConfiguration
protected boolean isMonitoringEnabled
protected int requestBufferSize
protected boolean useByteBufferView
ByteBuffer
from another ByteBuffer
protected int selectorTimeout
Selector
timeout value. By default, it is set to 60000
miliseconds (as in the j2se 1.5 ORB).
protected Class algorithmClass
StreamAlgorithm
used to predict the end of the NIO stream
protected String algorithmClassName
StreamAlgorithm
used to parse the NIO stream.
public static final String DEFAULT_ALGORITHM
protected int ssBackLog
protected String defaultResponseType
protected String forcedRequestType
protected String rootFolder
protected Controller controller
protected boolean rcmSupport
protected PUReadFilter portUnificationFilter
protected boolean oOBInline
protected HashMap<String,Object> properties
protected final Queue<ProcessorTask> processorTasks
Queue
used as an object pool.
If the list becomes empty, new ProcessorTask
will be
automatically added to the list.
protected final Queue<ProcessorTask> activeProcessorTasks
ProcessorTask
.
protected int readThreadsCount
protected static Logger logger
protected static final StringManager sm
protected boolean disableUploadTimeout
protected int uploadTimeout
protected FileCacheFactory fileCacheFactory
protected int secondsMaxAge
protected int maxCacheEntries
FileCache
protected long minEntrySize
protected long maxEntrySize
protected long maxLargeFileCacheSize
protected long maxSmallFileCacheSize
protected boolean isFileCacheEnabled
protected boolean isLargeFileCacheEnabled
protected boolean asyncExecution
protected AsyncHandler asyncHandler
AsyncHandler
protected static boolean defaultAlgorithmInstalled
protected static boolean enableNioLogging
protected static final ConcurrentHashMap<Integer,SelectorThread> selectorThreads
protected boolean forceKeepAlive
protected volatile ProcessorTaskFactory processorTaskFactory
Constructor Detail |
---|
public SelectorThread()
Selector
object. Each instance of this class
will listen to a specific port.
Method Detail |
---|
@Deprecated public static SelectorThread getSelector(int port)
getSelector(java.net.InetAddress, int)
.
SelectorThread
which listen on port, or null
if there is no SelectorThread
.
public static SelectorThread getSelector(InetAddress address, int port)
public static Enumeration<SelectorThread> getSelectors()
Enumeration
of the active
SelectorThread
s
public void registerKey(SelectionKey key)
SelectionKey
to this Selector
running of this thread.
protected void initController()
protected TCPSelectorHandler createSelectorHandler()
TCPSelectorHandler
protected SelectorThreadKeyHandler createSelectionKeyHandler()
SelectorThreadKeyHandler
protected void configureProtocolChain()
ProtocolChain
protected void configureSelectorHandler(TCPSelectorHandler selectorHandler)
TCPSelectorHandler
protected ProtocolFilter createRaFilter()
ProtocolFilter
ProtocolFilter
protected ProtocolFilter createHttpParserFilter()
ProtocolFilter
ProtocolFilter
protected void configureFilters(ProtocolChain protocolChain)
ProtocolChain
's filters
{@link
- ProtocolChain} to configurepublic void configurePortUnification(Properties props)
Properties
props
- Properties
. If props is null - port unification
will be configured from System propertiespublic void configurePortUnification(List<ProtocolFinder> protocolFinders, List<ProtocolHandler> protocolHandlers, List<PUPreProcessor> preProcessors)
List
s
protocolFinders
- ProtocolFinder
sprotocolHandlers
- ProtocolHandler
spreProcessors
- PUPreProcessor
spublic ProtocolChain getProtocolChain()
ProtocolChain
used by this instance.
ProtocolChain
protected ExecutorService newThreadPool(int maxQueueSize, String name, int port, int priority)
StatsThreadPool
instance.
protected void initFileCacheFactory()
FileCacheFactory
associated with this instance
protected FileCacheFactory createFileCacheFactory()
protected void configureFileCacheFactory()
protected void enableThreadPoolStats()
ThreadPoolStatistic
into every
ExecutorService
, for monitoring purposes.
protected void disableThreadPoolStats()
ThreadPoolStatistic
from every
ExecutorService
, when monitoring has been turned off.
protected void initAlgorithm()
StreamAlgorithm
class.
public void initThreadPool()
StatsThreadPool
s used by the WorkerThread
s.
protected void initProcessorTask(int size)
ProcessorTask
protected void rampUpProcessorTask()
ProcessorTask
protected ProcessorTask newProcessorTask(boolean initialize)
ProcessorTask
objects and configure it to be ready
to proceed request.
protected ProcessorTask configureProcessorTask(ProcessorTask task)
protected void reconfigureAsyncExecution()
protected void reconfigureAdapter()
public ProcessorTask getProcessorTask()
ProcessorTask
from the pool. If the pool is empty,
create a new instance.
public void start()
public void run()
run
in interface Runnable
public void initEndpoint() throws IOException, InstantiationException
ServerScoketChannel
and by initializing the server socket.
IOException
InstantiationException
public void stopEndpoint()
public void startEndpoint() throws IOException, InstantiationException
IOException
InstantiationException
public void listen() throws IOException, InstantiationException
listen
in interface GrizzlyListener
IOException
InstantiationException
protected void startThreadPool()
ExecutorService
used by this Selector
protected void stopThreadPool()
ExecutorService
used by this Selector
protected void startListener()
Selector
object.
public void cancelKey(SelectionKey key)
SelectionKey
public void returnTask(Task task)
Task
object to the pool.
protected void clearTasks()
Tasks
public int getPortLowLevel()
getPort()
instead
getPort()
, but getting port number directly from
connection (ServerSocket
, DatagramSocket
).
So if default port number 0 was set during initialization, then getPort()
will return 0, but getPortLowLevel() will return port number assigned by OS.
SelectorThread
was not startedpublic int getPort()
public void setPort(int port)
public InetAddress getAddress()
public void setAddress(InetAddress inet)
public boolean isRunning()
public void setServerTimeout(int timeout)
By default this value is 1000ms.
public boolean getTcpNoDelay()
public void setTcpNoDelay(boolean b)
public int getLinger()
public void setLinger(int i)
public int getServerTimeout()
public InetAddress getInet()
public void setInet(InetAddress inet)
public int getSocketTimeout()
public void setSocketTimeout(int socketTimeout)
public int getMaxKeepAliveRequests()
public void setMaxKeepAliveRequests(int maxKeepAliveRequests)
public void setKeepAliveTimeoutInSeconds(int timeout)
timeout
- Keep-alive timeout in number of secondspublic int getKeepAliveTimeoutInSeconds()
public void setAdapter(Adapter adapter)
setAdapter
in interface GrizzlyListener
adapter
- the new adapterpublic Adapter getAdapter()
getAdapter
in interface GrizzlyListener
protected void setSocketOptions(Socket socket)
public ObjectName getObjectName()
public String getDomain()
public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception
preRegister
in interface MBeanRegistration
Exception
public void postRegister(Boolean registrationDone)
postRegister
in interface MBeanRegistration
public void preDeregister() throws Exception
preDeregister
in interface MBeanRegistration
Exception
public void postDeregister()
postDeregister
in interface MBeanRegistration
public void registerComponents()
SelectorThread
. This
include FileCache
, RequestInfo
, KeepAliveStats
and StatsThreadPool
. The Management.registerComponent(java.lang.Object, javax.management.ObjectName, java.lang.String)
will be invoked during the registration process.
protected void unregisterComponents()
SelectorThread
. This
include FileCache
, RequestInfo
, KeepAliveStats
, StatsThreadPool
and ProcessorTask
.
The Management.unregisterComponent(javax.management.ObjectName)
will be invoked during the
registration process.
public Management getManagement()
Management
interface, or null if JMX management is
no enabled.
Management
public void setManagement(Management jmxManagement)
Management
interface. Setting this interface automatically
expose Grizzly HTTP Engine mbeans.
jmxManagement
- public void enableMonitoring()
public void disableMonitoring()
public boolean isMonitoringEnabled()
public RequestGroupInfo getRequestGroupInfo()
public KeepAliveStats getKeepAliveStats()
protected void initMonitoringLevel()
ThreadPoolStatistic
instance.
public int getMaxHttpHeaderSize()
public void setMaxHttpHeaderSize(int maxHttpHeaderSize)
public boolean isAsyncHttpWriteEnabled()
public void setAsyncHttpWriteEnabled(boolean isAsyncHttpWriteEnabled)
isAsyncHttpWriteEnabled
- true, if async HTTP
write enabled, or false otherwise.public void setBufferSize(int requestBufferSize)
public int getBufferSize()
public Selector getSelector()
Selector
, please request context associated SelectorHandler: SelectorHandler.getSelector()
Selector
public TCPSelectorHandler getSelectorHandler()
SelectorHandler
, which is usually provided by
the current Context
.
SelectorHandler
public Controller getController()
public void setController(Controller controller)
public void removeCacheEntry(String contextPath)
FileCache
.
public void setSecondsMaxAge(int sMaxAges)
FileCache.FileCacheEntry
from the FileCache
public void setMaxCacheEntries(int mEntries)
public int getMaxCacheEntries()
public void setMinEntrySize(long mSize)
FileCache.FileCacheEntry
can have.
public long getMinEntrySize()
FileCache.FileCacheEntry
can have.
public void setMaxEntrySize(long mEntrySize)
FileCache.FileCacheEntry
can have.
public long getMaxEntrySize()
FileCache.FileCacheEntry
can have.
public void setMaxLargeCacheSize(long mCacheSize)
public long getMaxLargeCacheSize()
public void setMaxSmallCacheSize(long mCacheSize)
public long getMaxSmallCacheSize()
public boolean isFileCacheEnabled()
public void setFileCacheIsEnabled(boolean isFileCacheEnabled)
public void setLargeFileCacheEnabled(boolean isLargeEnabled)
public boolean getLargeFileCacheEnabled()
public void setEnableAsyncExecution(boolean asyncExecution)
AsyncHandler
used when asynchronous
public boolean getEnableAsyncExecution()
public void setAsyncHandler(AsyncHandler asyncHandler)
AsyncHandler
used when asynchronous execution is
enabled.
public AsyncHandler getAsyncHandler()
AsyncHandler
used when asynchronous execution is
enabled.
public static void setLogger(Logger l)
public static Logger logger()
public void setWebAppRootPath(String rf)
public String getWebAppRootPath()
public boolean getBufferResponse()
public void setBufferResponse(boolean bufferResponse)
public void enableRcmSupport(boolean rcmSupport)
public boolean isRcmSupported()
protected void configureCompression(ProcessorTask processorTask)
public String getCompression()
public void setCompression(String compression)
public String getNoCompressionUserAgents()
public void setNoCompressionUserAgents(String noCompressionUserAgents)
public String getRestrictedUserAgents()
public void setRestrictedUserAgents(String restrictedUserAgents)
public String getCompressableMimeTypes()
public void setCompressableMimeTypes(String compressableMimeTypes)
public int getCompressionMinSize()
public void setCompressionMinSize(int compressionMinSize)
public int getSelectorReadThreadsCount()
public void setSelectorReadThreadsCount(int readThreadsCount)
public ExecutorService getThreadPool()
public void setThreadPool(ExecutorService threadPool)
ExecutorService
this class should use. A ExecutorService
must ensure its ThreadFactory
return Thread which are instance
of HttpWorkerThread
.
threadPool
- - the thread pool used by this instance.public boolean isUseDirectByteBuffer()
public void setUseDirectByteBuffer(boolean useDirectByteBuffer)
public void setDisplayConfiguration(boolean displayConfiguration)
public boolean isUseByteBufferView()
public void setUseByteBufferView(boolean useByteBufferView)
public int getSelectorTimeout()
public void setSelectorTimeout(int aSelectorTimeout)
public String getAlgorithmClassName()
public void setAlgorithmClassName(String algorithmClassName)
public int getSsBackLog()
public void setSsBackLog(int ssBackLog)
public String getDefaultResponseType()
public void setDefaultResponseType(String defaultResponseType)
public String getForcedRequestType()
public void setForcedRequestType(String forcedRequestType)
public Queue<ProcessorTask> getActiveProcessorTasks()
public ClassLoader getClassLoader()
public void setClassLoader(ClassLoader classLoader)
ClassLoader
used to load configurable
classes (ExecutorService, StreamAlgorithm).
public static boolean isEnableNioLogging()
public static void setEnableNioLogging(boolean enl)
public int getMaxPostSize()
public void setMaxPostSize(int maxPostSize)
public void setReuseAddress(boolean reuseAddress)
public boolean getReuseAddress()
public SelectorThreadKeyHandler getSelectorThreadKeyHandler()
public void setDisableUploadTimeout(boolean isDisabled)
public boolean getDisableUploadTimeout()
public void setUploadTimeout(int uploadTimeout)
public int getUploadTimeout()
public int getTransactionTimeout()
WorkerThread
executing
an instance of this class can execute.
public void setTransactionTimeout(int transactionTimeout)
WorkerThread
processing
an instance of this class.
transactionTimeout
- the maximum time, in milliseconds.public boolean isUseChunking()
public void setUseChunking(boolean useChunking)
useChunking
- public Object getProperty(String name)
public void setProperty(String name, Object value)
public void removeProperty(String name)
public int getMaxThreads()
public void setMaxThreads(int maxThreads)
public int getCoreThreads()
public void setCoreThreads(int coreThreads)
public String getThreadPoolClassname()
public void setThreadPoolClassname(String threadPoolClassname)
public String protocol()
GrizzlyListener
protocol
in interface GrizzlyListener
public void setForceKeepAlive(boolean forceKeepAlive)
public boolean getForceKeepAlive()
public void addAsyncEnabledContextPath(String s)
AsyncHandler
.
s
- A context-path that will be allowed to execute using theprotected KeepAliveStats createKeepAliveStats()
public int getSendBufferSize()
public void setSendBufferSize(int sendBufferSize)
sendBufferSize
- the sendBufferSize to setpublic ProcessorTaskFactory getProcessorTaskFactory()
ProcessorTaskFactory
.
ProcessorTaskFactory
public void setProcessorTaskFactory(ProcessorTaskFactory processorTaskFactory)
ProcessorTaskFactory
.
processorTaskFactory
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |