com.sun.enterprise.web.connector.grizzly
Class XAReadTask

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.XAReadTask
All Implemented Interfaces:
ReadTask, Task, TaskListener, Runnable, Callable

public class XAReadTask
extends DefaultReadTask

Read available data on a non blocking SocketChannel. StreamAlgorithm stategy will decide if more bytes are required or not. Once the StreamAlgorithm is ready, the ProcessorTask attached to this class will be executed.

Author:
Scott Oaks, Jean-Francois Arcand

Field Summary
protected  boolean inKeepAliveProcess
          If the last request was processed successfully and we need to keep-alive the connection, unattach thsi object from the SelectionKey and return it to the pool.
 
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
XAReadTask()
           
 
Method Summary
 void doTask()
          Read data from the socket and process it using this thread, and only if the StreamAlgorith stategy determine no more bytes are are needed.
 boolean executeProcessorTask()
          Execute the ProcessorTask only if the request has been fully read.
protected  void manageKeepAlive(boolean keepAlive, int count, Exception exception)
          Evaluate if the SelectionKey needs to be registered to the main Selector
 void recycle()
          Clear the current state and make this object ready for another request.
 void terminate(boolean keepAlive)
          Complete the processing.
 
Methods inherited from class com.sun.enterprise.web.connector.grizzly.DefaultReadTask
attachProcessor, configureProcessorTask, detachProcessor, doTask, finishConnection, getByteBuffer, getIdleTime, getProcessorTask, initialize, registerKey, 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
 

Field Detail

inKeepAliveProcess

protected boolean inKeepAliveProcess
If the last request was processed successfully and we need to keep-alive the connection, unattach thsi object from the SelectionKey and return it to the pool.

Constructor Detail

XAReadTask

public XAReadTask()
Method Detail

doTask

public void doTask()
            throws IOException
Read data from the socket and process it using this thread, and only if the StreamAlgorith stategy determine no more bytes are are needed.

Specified by:
doTask in interface Task
Overrides:
doTask in class DefaultReadTask
Throws:
IOException

manageKeepAlive

protected void manageKeepAlive(boolean keepAlive,
                               int count,
                               Exception exception)
Description copied from class: DefaultReadTask
Evaluate if the SelectionKey needs to be registered to the main Selector

Overrides:
manageKeepAlive in class DefaultReadTask

executeProcessorTask

public boolean executeProcessorTask()
                             throws IOException
Execute the ProcessorTask only if the request has been fully read. Guest the size of the request by using the content-type HTTP headers.

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

terminate

public void terminate(boolean keepAlive)
Complete the processing.

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

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 DefaultReadTask


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