Methods Summary |
---|
public void | attachProcessor(com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask processorTask)Force this task to always use the same ProcessorTask
instance.
handler = new NoParsingHandler();
this.processorTask = processorTask;
processorTask.setHandler(handler);
|
public void | doTask()Dispatch an Http request to a ProcessorTask
Socket socket = processorTask.getSocket();
SelectorBlockingThread blockingSelector =
(SelectorBlockingThread)selectorThread;
blockingSelector.setSocketOptions(socket);
if (isSecure) {
try {
blockingSelector.getServerSocketFactory().handshake(socket);
} catch (Throwable ex) {
selectorThread.getLogger().log(Level.FINE,
"selectorThread.sslHandshakeException", ex);
try {
socket.close();
} catch (IOException ioe){
// Do nothing
}
taskEvent.setStatus(TaskEvent.COMPLETED);
taskEvent(taskEvent);
return;
}
}
processorTask.addTaskListener(this);
addTaskListener((ProcessorBlockingTask)processorTask);
handler.attachChannel(socket.getChannel());
// Notify the ProcessorTask that we are ready to process the request.
fireTaskEvent(taskEvent);
|
protected void | finishConnection()Gracefully close the blocking socket.
Socket socket = processorTask.getSocket();
if ( !isSecure ) {
try{
if (!socket.isInputShutdown()){
socket.shutdownInput();
}
} catch (IOException ioe){
;
}
try{
if (!socket.isOutputShutdown()){
socket.shutdownOutput();
}
} catch (IOException ex){
;
}
}
try{
socket.close();
} catch (IOException ex){
;
} finally {
if (isMonitoringEnabled()) {
getRequestGroupInfo().decreaseCountOpenConnections();
}
}
|
public com.sun.enterprise.web.connector.grizzly.PipelineStatistic | getPipelineStatistic()Return the PipelineStatistic object used
to gather statistic;
return pipelineStat;
|
public boolean | getSecure()Return the isSecure.
return isSecure;
|
public java.net.Socket | getSocket()Return the current Socket used by this instance
return processorTask.getSocket();
|
public void | recycle()Clear the current state and make this object ready for another request.
clearTaskListeners();
taskEvent.setStatus(TaskEvent.START);
|
public void | setPipelineStatistic(com.sun.enterprise.web.connector.grizzly.PipelineStatistic pipelineStatistic)Set the PipelineStatistic object used to gather statistic;
this.pipelineStat = pipelineStatistic;
|
public void | setSecure(boolean isSecure)Set the isSecure attribute.
this.isSecure = isSecure;
|
public void | taskEvent(com.sun.enterprise.web.connector.grizzly.TaskEvent event)Receive notification from other Task and recycle this task.
if ( event.getStatus() == TaskEvent.COMPLETED){
finishConnection();
// We must recycle only if we are sure ProcessorTask has completed its
// processing. If not,
if (recycle) {
processorTask.recycle();
recycle();
selectorThread.returnTask(this);
}
}
|