com.sun.enterprise.web.connector.grizzly.ssl
Class SSLAsyncReadTask

java.lang.Object
  extended by com.sun.enterprise.web.connector.grizzly.TaskBase
      extended by com.sun.enterprise.web.connector.grizzly.DefaultReadTask
          extended by com.sun.enterprise.web.connector.grizzly.ssl.SSLReadTask
              extended by com.sun.enterprise.web.connector.grizzly.ssl.SSLAsyncReadTask
All Implemented Interfaces:
ReadTask, Task, TaskListener, Runnable, Callable

public class SSLAsyncReadTask
extends SSLReadTask

Asynchronous SSL support over NIO. This Task handles the SSL requests using a non blocking socket. The SSL handshake is done using this class. Once the handshake is successful, the SSLProcessorTask is executed.

Author:
Jean-Francois Arcand

Field Summary
 
Fields inherited from class com.sun.enterprise.web.connector.grizzly.ssl.SSLReadTask
appBBSize, handshake, inputBB, inputBBSize, outputBB, sslEngine, sslImplementation
 
Fields inherited from class com.sun.enterprise.web.connector.grizzly.DefaultReadTask
algorithm, byteBuffer, bytesAvailable, inputStream, maxPostSize, processorTask, taskContext, taskEvent, useByteBufferView, useDirectByteBuffer
 
Fields inherited from class com.sun.enterprise.web.connector.grizzly.TaskBase
key, listeners, pipeline, recycle, selectorThread, type
 
Fields inherited from interface com.sun.enterprise.web.connector.grizzly.Task
ACCEPT_TASK, PROCESSOR_TASK, READ_TASK
 
Constructor Summary
SSLAsyncReadTask()
           
 
Method Summary
 void allocateBuffers()
          Allocate themandatory ByteBuffers.
 void configureProcessorTask()
          Set appropriate attribute on the ProcessorTask.
 boolean executeProcessorTask()
          Execute the ProcessorTask
 void initialize(StreamAlgorithm algorithm, boolean useDirectByteBuffer, boolean useByteBufferView)
          Initialize this object.
protected  void manageKeepAlive(boolean keepAlive, int count, Exception exception)
          Manage the SelectionKey
protected  boolean process()
          Process the request using the decrypted ByteBuffer.
 void recycle()
          Clear the current state and make this object ready for another request.
 void terminate(boolean keepAlive)
          Complete the transaction.
 
Methods inherited from class com.sun.enterprise.web.connector.grizzly.ssl.SSLReadTask
detachProcessor, doHandshake, doPeerCertificateChain, doTask, getHandshake, getInputBB, getOutputBB, getSSLEngine, registerKey, setHandshake, setInputBB, setOutputBB, setSSLEngine, setSSLImplementation
 
Methods inherited from class com.sun.enterprise.web.connector.grizzly.DefaultReadTask
attachProcessor, doTask, finishConnection, getByteBuffer, getIdleTime, getProcessorTask, returnTask, setByteBuffer, setBytesAvailable, setIdleTime, taskEvent
 
Methods inherited from class com.sun.enterprise.web.connector.grizzly.TaskBase
addTaskListener, call, cancelTask, clearTaskListeners, execute, fireTaskEvent, getKeepAliveStats, getPipeline, getRecycle, getRequestGroupInfo, getSelectionKey, getSelectorThread, getSocket, getTaskListeners, getType, isMonitoringEnabled, removeTaskListener, run, setPipeline, setRecycle, setSelectionKey, setSelectorThread
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sun.enterprise.web.connector.grizzly.Task
addTaskListener, cancelTask, clearTaskListeners, execute, getKeepAliveStats, getPipeline, getRecycle, getRequestGroupInfo, getSelectionKey, getSelectorThread, getTaskListeners, getType, isMonitoringEnabled, removeTaskListener, setPipeline, setRecycle, setSelectionKey, setSelectorThread
 
Methods inherited from interface java.lang.Runnable
run
 
Methods inherited from interface java.util.concurrent.Callable
call
 

Constructor Detail

SSLAsyncReadTask

public SSLAsyncReadTask()
Method Detail

allocateBuffers

public void allocateBuffers()
Allocate themandatory ByteBuffers. Since the ByteBuffer are maintaned on the SSLWorkerThread lazily, this method makes sure the ByteBuffers are properly allocated and configured.

Overrides:
allocateBuffers in class SSLReadTask

initialize

public void initialize(StreamAlgorithm algorithm,
                       boolean useDirectByteBuffer,
                       boolean useByteBufferView)
Initialize this object.

Specified by:
initialize in interface ReadTask
Overrides:
initialize in class SSLReadTask

manageKeepAlive

protected void manageKeepAlive(boolean keepAlive,
                               int count,
                               Exception exception)
Manage the SelectionKey

Overrides:
manageKeepAlive in class DefaultReadTask

process

protected boolean process()
                   throws IOException
Description copied from class: SSLReadTask
Process the request using the decrypted ByteBuffer. The SSLProcessorTask

Overrides:
process in class SSLReadTask
Throws:
IOException

executeProcessorTask

public boolean executeProcessorTask()
                             throws IOException
Execute the ProcessorTask

Overrides:
executeProcessorTask in class DefaultReadTask
Returns:
false if the request wasn't fully read by the channel. so we need to respin the key on the Selector.
Throws:
IOException

recycle

public void recycle()
Clear the current state and make this object ready for another request.

Specified by:
recycle in interface Task
Overrides:
recycle in class SSLReadTask

terminate

public void terminate(boolean keepAlive)
Complete the transaction.

Specified by:
terminate in interface ReadTask
Overrides:
terminate in class DefaultReadTask

configureProcessorTask

public void configureProcessorTask()
Set appropriate attribute on the ProcessorTask.

Overrides:
configureProcessorTask in class SSLReadTask


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