com.sun.enterprise.web.connector.grizzly.blocking
Class SelectorBlockingThread

java.lang.Object
  extended by java.lang.Thread
      extended by com.sun.enterprise.web.connector.grizzly.SelectorThread
          extended by com.sun.enterprise.web.connector.grizzly.blocking.SelectorBlockingThread
All Implemented Interfaces:
SecureSelector<SSLImplementation>, Runnable, MBeanRegistration

public class SelectorBlockingThread
extends SelectorThread
implements SecureSelector<SSLImplementation>

Blocking SocketServer implementation.

Author:
jean-Francois Arcand

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
protected  SSLImplementation sslImplementation
           
 
Fields inherited from class com.sun.enterprise.web.connector.grizzly.SelectorThread
activeProcessorTasks, adapter, algorithmClass, algorithmClassName, asyncExecution, asyncHandler, bannedKeys, bufferResponse, compressableMimeTypes, compression, compressionMinSize, currentConnectionNumber, DEFAULT_ALGORITHM, defaultAlgorithmInstalled, defaultResponseType, disableUploadTimeout, displayConfiguration, domain, enableNioLogging, fileCacheFactory, forcedRequestType, globalRequestProcessor, globalRequestProcessorName, inet, initialized, isFileCacheEnabled, isLargeFileCacheEnabled, isMonitoringEnabled, isWaiting, keepAlivePipeline, keepAliveTimeoutInSeconds, linger, logger, maxCacheEntries, maxEntrySize, maxHttpHeaderSize, maxKeepAliveRequests, maxLargeFileCacheSize, maxPostSize, maxProcessorWorkerThreads, maxQueueSizeInBytes, maxReadWorkerThreads, maxSelectors, maxSmallFileCacheSize, minEntrySize, minProcessorQueueLength, minReadQueueLength, minSpareThreads, minWorkerThreads, mserver, multiSelectorsCount, noCompressionUserAgents, oname, oOBInline, pipelineClassName, pipelineStat, port, processorPipeline, processorTasks, processorWorkerThreadName, readPipeline, readTasks, readThreads, recycleTasks, requestBufferSize, restrictedUserAgents, rootFolder, running, secondsMaxAge, selector, selectorTimeout, SERVER_NAME, serverSocket, serverSocketChannel, serverTimeout, socketKeepAlive, socketReceiveBufferSize, socketSendBufferSize, socketTimeout, ssBackLog, tcpNoDelay, threadsIncrement, threadsTimeout, uploadTimeout, useByteBufferView, useDirectByteBuffer
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
SelectorBlockingThread()
           
 
Method Summary
protected  Socket acceptSocket()
           
 String[] getEnabledCipherSuites()
          Returns the list of cipher suites to be enabled when SSLEngine is initialized.
 String[] getEnabledProtocols()
          Returns the list of protocols to be enabled when SSLEngine is initialized.
protected  ReadBlockingTask getReadBlockingTask(Socket socket)
          Return a ReadBlockingTask from the pool.
 ServerSocketFactory getServerSocketFactory()
          Return the ServerSocketFactory used when a blocking IO is enabled.
 SSLImplementation getSSLImplementation()
          Return the current SSLImplementation this Thread
 void initEndpoint()
          initialized the endpoint by creating the ServerSocketChannel and by initializing the server socket.
 boolean isClientMode()
          Returns true if the SSlEngine is set to use client mode when handshaking.
 boolean isNeedClientAuth()
          Returns true if the SSLEngine will require client authentication.
 boolean isWantClientAuth()
          Returns true if the engine will request client authentication.
protected  DefaultProcessorTask newProcessorTask(boolean initialize)
          Create ProcessorTask objects and configure it to be ready to proceed request.
 void setClientMode(boolean clientMode)
          Configures the engine to use client (or server) mode when handshaking.
 void setEnabledCipherSuites(String[] enabledCipherSuites)
          Sets the list of cipher suites to be enabled when SSLEngine is initialized.
 void setEnabledProtocols(String[] enabledProtocols)
          Sets the list of protocols to be enabled when SSLEngine is initialized.
 void setNeedClientAuth(boolean needClientAuth)
          Configures the engine to require client authentication.
 void setSecure(boolean secure)
           
 void setServerSocketFactory(ServerSocketFactory factory)
          Set the ServerSocketFactory used when a blocking IO is enabled.
protected  void setSocketOptions(Socket socket)
           
 void setSSLImplementation(SSLImplementation sslImplementation)
          Set the SSLImplementation used by this thread.It usually means HTTPS will be used.
 void setWantClientAuth(boolean wantClientAuth)
          Configures the engine to request client authentication.
 void startEndpoint()
          Start the Acceptor Thread and wait for incoming connection, in a non blocking mode.
protected  void startListener()
          Start a blocking server Socket
 void stopEndpoint()
          Stop a blocking server Socket
 
Methods inherited from class com.sun.enterprise.web.connector.grizzly.SelectorThread
addBannedSelectionKey, cancelKey, cancelThreadExecution, clearTasks, configureCompression, configureProcessorTask, configureReadThread, disableMonitoring, disablePipelineStats, doSelect, enableCometSupport, enableMonitoring, enablePipelineStats, enableRcmSupport, enableSelectionKeys, expireIdleKeys, getActiveProcessorTasks, getAdapter, getAddress, getAlgorithmClass, getAlgorithmClassName, getAsyncHandler, getBufferResponse, getBufferSize, getClassLoader, getCompressableMimeTypes, getCompression, getCompressionMinSize, getCountThreadsIdleStats, getCountThreadsStats, getCurReadThread, getCurrentBusyProcessorThreads, getCurrentConnectionNumber, getCurrentThreadCountStats, getCurrentThreadsBusyStats, getDefaultResponseType, getDisableUploadTimeout, getDomain, getEnableAsyncExecution, getForcedRequestType, getGlobalRequestProcessor, getGlobalRequestProcessorName, getInet, getKaTimeout, getKeepAliveMbeanName, getKeepAlivePipeline, getKeepAliveStats, getKeepAliveTimeoutInSeconds, getKeysToEnable, getLargeFileCacheEnabled, getLinger, getLogger, getManagement, getMaxCacheEntries, getMaxEntrySize, getMaxHttpHeaderSize, getMaxKeepAliveRequests, getMaxLargeCacheSize, getMaxPostSize, getMaxProcessorWorkerThreads, getMaxQueueSizeInBytes, getMaxReadWorkerThreads, getMaxSelectors, getMaxSmallCacheSize, getMaxSpareThreads, getMaxSpareThreadsStats, getMaxThreads, getMaxThreadsStats, getMinEntrySize, getMinProcessorQueueLength, getMinReadQueueLength, getMinSpareThreads, getMinSpareThreadsStats, getMinWorkerThreads, getMserver, getNextKeysExpiration, getNoCompressionUserAgents, getObjectName, getOname, getPipelineClassName, getPipelineStat, getPort, getPortLowLevel, getProcessorPipeline, getProcessorTask, getProcessorTasks, getProcessorWorkerThreadName, getPwcConnectionQueueMbeanName, getPwcFileCacheMbeanName, getQueueSizeInBytes, getReadPipeline, getReadTask, getReadTasks, getRequestGroupInfo, getRestrictedUserAgents, getReuseAddress, getRootFolder, getSelector, getSelector, getSelectorReadThreadsCount, getSelectors, getSelectorTimeout, getServerSocket, getServerSocketChannel, getServerSoTimeout, getServerTimeout, getSocketReceiveBufferSize, getSocketSendBufferSize, getSocketTimeout, getSoLinger, getSoTimeout, getSpinRate, getSsBackLog, getTcpNoDelay, getThreadsIncrement, getThreadsTimeout, getTimeout, getTransactionTimeout, getWebAppRootPath, handleAccept, handleConnection, handleRead, initAlgorithm, initFileCacheFactory, initKeepAlivePipeline, initMonitoringLevel, initMultiSelectors, initPipeline, initProcessorTask, initReadTask, isBufferResponse, isDisplayConfiguration, isEnableNioLogging, isFileCacheEnabled, isInitialized, isIsMonitoringEnabled, isMonitoringEnabled, isRecycleTasks, isRunning, isSocketKeepAlive, isTcpNoDelay, isUseByteBufferView, isUseDirectByteBuffer, logger, newPipeline, newReadTask, postDeregister, postRegister, preDeregister, preRegister, rampUpProcessorTask, reconfigureAsyncExecution, registerComponents, registerKey, removeCacheEntry, resetSpinCounter, returnTask, run, setActiveProcessorTasks, setAdapter, setAddress, setAlgorithmClass, setAlgorithmClassName, setAsyncHandler, setBufferResponse, setBufferSize, setClassLoader, setCompressableMimeTypes, setCompression, setCompressionMinSize, setCurReadThread, setCurrentConnectionNumber, setDefaultResponseType, setDisableUploadTimeout, setDisplayConfiguration, setDomain, setEnableAsyncExecution, setEnableNioLogging, setFileCacheIsEnabled, setForcedRequestType, setGlobalRequestProcessor, setGlobalRequestProcessorName, setInet, setInitialized, setIsMonitoringEnabled, setIsWaiting, setKaTimeout, setKeepAliveMbeanName, setKeepAlivePipeline, setKeepAliveStats, setKeepAliveThreadCount, setKeepAliveTimeoutInSeconds, setKeysToEnable, setLargeFileCacheEnabled, setLinger, setLogger, setManagement, setMaxCacheEntries, setMaxEntrySize, setMaxHttpHeaderSize, setMaxKeepAliveRequests, setMaxLargeCacheSize, setMaxPostSize, setMaxProcessorWorkerThreads, setMaxQueueSizeInBytes, setMaxReadWorkerThreads, setMaxSelectors, setMaxSmallCacheSize, setMaxSpareThreads, setMaxThreads, setMinEntrySize, setMinProcessorQueueLength, setMinReadQueueLength, setMinSpareThreads, setMinThreads, setMinWorkerThreads, setMserver, setNextKeysExpiration, setNoCompressionUserAgents, setOname, setPipelineClassName, setPipelineStat, setPort, setProcessorPipeline, setProcessorTasks, setProcessorWorkerThreadName, setPwcConnectionQueueMbeanName, setPwcFileCacheMbeanName, setReadPipeline, setReadTasks, setRecycleTasks, setRestrictedUserAgents, setReuseAddress, setRootFolder, setRunning, setSecondsMaxAge, setSelector, setSelectorReadThreadsCount, setSelectorTimeout, setServerSocket, setServerSocketChannel, setServerSoTimeout, setServerTimeout, setSocketKeepAlive, setSocketReceiveBufferSize, setSocketSendBufferSize, setSocketTimeout, setSoLinger, setSoTimeout, setSsBackLog, setTcpNoDelay, setThreadsIncrement, setThreadsTimeout, setTransactionTimeout, setUploadTimeout, setUseByteBufferView, setUseDirectByteBuffer, setWebAppRootPath, startPipelines, stopPipelines, unregisterComponents, wakeup
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sslImplementation

protected SSLImplementation sslImplementation
Constructor Detail

SelectorBlockingThread

public SelectorBlockingThread()
Method Detail

initEndpoint

public void initEndpoint()
                  throws IOException,
                         InstantiationException
initialized the endpoint by creating the ServerSocketChannel and by initializing the server socket.

Overrides:
initEndpoint in class SelectorThread
Throws:
IOException
InstantiationException

getReadBlockingTask

protected ReadBlockingTask getReadBlockingTask(Socket socket)
Return a ReadBlockingTask from the pool. If the pool is empty, create a new instance.


setSocketOptions

protected void setSocketOptions(Socket socket)
Overrides:
setSocketOptions in class SelectorThread

startEndpoint

public void startEndpoint()
                   throws IOException,
                          InstantiationException
Start the Acceptor Thread and wait for incoming connection, in a non blocking mode.

Overrides:
startEndpoint in class SelectorThread
Throws:
IOException
InstantiationException

stopEndpoint

public void stopEndpoint()
Stop a blocking server Socket

Overrides:
stopEndpoint in class SelectorThread

acceptSocket

protected Socket acceptSocket()

startListener

protected void startListener()
Start a blocking server Socket

Overrides:
startListener in class SelectorThread

newProcessorTask

protected DefaultProcessorTask newProcessorTask(boolean initialize)
Create ProcessorTask objects and configure it to be ready to proceed request.

Overrides:
newProcessorTask in class SelectorThread

getServerSocketFactory

public ServerSocketFactory getServerSocketFactory()
Return the ServerSocketFactory used when a blocking IO is enabled.

Specified by:
getServerSocketFactory in interface SecureSelector<SSLImplementation>

setServerSocketFactory

public void setServerSocketFactory(ServerSocketFactory factory)
Set the ServerSocketFactory used when a blocking IO is enabled.

Specified by:
setServerSocketFactory in interface SecureSelector<SSLImplementation>

setSecure

public void setSecure(boolean secure)

getSSLImplementation

public SSLImplementation getSSLImplementation()
Return the current SSLImplementation this Thread


setSSLImplementation

public void setSSLImplementation(SSLImplementation sslImplementation)
Set the SSLImplementation used by this thread.It usually means HTTPS will be used.

Specified by:
setSSLImplementation in interface SecureSelector<SSLImplementation>

getEnabledCipherSuites

public String[] getEnabledCipherSuites()
Description copied from interface: SecureSelector
Returns the list of cipher suites to be enabled when SSLEngine is initialized.

Specified by:
getEnabledCipherSuites in interface SecureSelector<SSLImplementation>
Returns:
null means 'use SSLEngine's default.'

setEnabledCipherSuites

public void setEnabledCipherSuites(String[] enabledCipherSuites)
Description copied from interface: SecureSelector
Sets the list of cipher suites to be enabled when SSLEngine is initialized.

Specified by:
setEnabledCipherSuites in interface SecureSelector<SSLImplementation>

getEnabledProtocols

public String[] getEnabledProtocols()
Description copied from interface: SecureSelector
Returns the list of protocols to be enabled when SSLEngine is initialized.

Specified by:
getEnabledProtocols in interface SecureSelector<SSLImplementation>
Returns:
null means 'use SSLEngine's default.'

setEnabledProtocols

public void setEnabledProtocols(String[] enabledProtocols)
Description copied from interface: SecureSelector
Sets the list of protocols to be enabled when SSLEngine is initialized.

Specified by:
setEnabledProtocols in interface SecureSelector<SSLImplementation>

isClientMode

public boolean isClientMode()
Description copied from interface: SecureSelector
Returns true if the SSlEngine is set to use client mode when handshaking.

Specified by:
isClientMode in interface SecureSelector<SSLImplementation>

setClientMode

public void setClientMode(boolean clientMode)
Description copied from interface: SecureSelector
Configures the engine to use client (or server) mode when handshaking.

Specified by:
setClientMode in interface SecureSelector<SSLImplementation>

isNeedClientAuth

public boolean isNeedClientAuth()
Description copied from interface: SecureSelector
Returns true if the SSLEngine will require client authentication.

Specified by:
isNeedClientAuth in interface SecureSelector<SSLImplementation>

setNeedClientAuth

public void setNeedClientAuth(boolean needClientAuth)
Description copied from interface: SecureSelector
Configures the engine to require client authentication.

Specified by:
setNeedClientAuth in interface SecureSelector<SSLImplementation>

isWantClientAuth

public boolean isWantClientAuth()
Description copied from interface: SecureSelector
Returns true if the engine will request client authentication.

Specified by:
isWantClientAuth in interface SecureSelector<SSLImplementation>

setWantClientAuth

public void setWantClientAuth(boolean wantClientAuth)
Description copied from interface: SecureSelector
Configures the engine to request client authentication.

Specified by:
setWantClientAuth in interface SecureSelector<SSLImplementation>


Copyright © 2005-2015 Oracle Corporation. All Rights Reserved.