FileDocCategorySizeDatePackage
TaskContext.javaAPI DocGlassfish v2 API4179Fri May 04 22:37:06 BST 2007com.sun.enterprise.web.connector.grizzly

TaskContext

public class TaskContext extends Object
This class encapsulates the logic required to synchronized unblocking socket request with the blocked stream architecture of Tomcat.
author
Jean-Francois Arcand

Fields Summary
private InputStream
inputStream
Use a PipeInputStream since we are using a non blocking byteChannel.
private ByteBufferStream
outputStream
Use a PipeInputStream since we are using a non blocking byteChannel.
Constructors Summary
public TaskContext()
Create a instance of this object.

    
Methods Summary
public voidflush()
Flush bytes to the NonBlockinginputStream

   
        if (outputStream != null) {
            outputStream.flush();
        }
    
public java.io.InputStreamgetInputStream()
Return the input stream used by this request. The default stream is an instance of NonBlockinginputStream

        return inputStream;
    
public java.io.OutputStreamgetOutputStream()

        return (OutputStream)outputStream;
    
public voidrecycle()
Recycle all streams used by this object.

        if (inputStream != null){
            flush();
            inputStream.close();
        }
    
public voidsetInputStream(java.io.InputStream inputStream)

        this.inputStream = inputStream;
    
public voidsetOutputStream(ByteBufferStream outputStream)

        this.outputStream = outputStream;
    
public voidwrite(java.nio.ByteBuffer byteBuffer)
Fill the current output stream with the available bytes

  
        outputStream.write(byteBuffer);