FileDocCategorySizeDatePackage
SSLWorkerThread.javaAPI DocGlassfish v2 API5629Fri May 04 22:37:10 BST 2007com.sun.enterprise.web.connector.grizzly.ssl

SSLWorkerThread

public class SSLWorkerThread extends com.sun.enterprise.web.connector.grizzly.WorkerThreadImpl
Simple WorkerThread used to execute SSL over NIO requests. All ByteBuffer used by this class MUST be created by client of this classes.
author
Jean-Francois Arcand

Fields Summary
private ByteBuffer
inputBB
The encrypted ByteBuffer used for handshaking and reading request bytes.
private ByteBuffer
outputBB
The encrypted ByteBuffer used for handshaking and writing response bytes.
private SSLEngine
sslEngine
The SSLEngine used to manage the SSL over NIO request.
Constructors Summary
public SSLWorkerThread(ThreadGroup threadGroup, Runnable runnable)
Create a Thread that will synchronizes/block on SSLPipeline instance.

        super(threadGroup, runnable);    
    
public SSLWorkerThread(com.sun.enterprise.web.connector.grizzly.Pipeline pipeline, String name)
Create a Thread that will synchronizes/block on SSLPipeline instance.

        super(pipeline, name);  
    
Methods Summary
public java.nio.ByteBuffergetInputBB()
Return the encrypted ByteBuffer used to handle request.

        return inputBB;
    
public java.nio.ByteBuffergetOutputBB()
Return the encrypted ByteBuffer used to handle response.

        return outputBB;
    
public javax.net.ssl.SSLEnginegetSSLEngine()
Set the SSLEngine.

        return sslEngine;
    
public voidrun()
Perform a Task processing.


        if ( target != null ){
            target.run();
            return;
        }
        
        while (doTask) {
            try{
                // Wait for a Task to be added to the pipeline.
                Task t = pipeline.getTask();
                if (t != null){
                    t.run();                
                    t = null;
                }
            } catch (Throwable t) {         
                // Make sure we aren't leaving any bytes after an exception.
                if (byteBuffer != null){
                    byteBuffer.clear();
                }
                if (inputBB != null){
                    inputBB.clear();
                }
                if (outputBB != null){
                    outputBB.clear();
                }     
                SelectorThread.logger().log(Level.FINE,
                        "workerThread.httpException",t);
            } finally {
                sslEngine = null;
            }
        }
    
public voidsetInputBB(java.nio.ByteBuffer inputBB)
Set the encrypted ByteBuffer used to handle request.

        this.inputBB = inputBB;
    
public voidsetOutputBB(java.nio.ByteBuffer outputBB)
Set the encrypted ByteBuffer used to handle response.

        this.outputBB = outputBB;
    
public voidsetSSLEngine(javax.net.ssl.SSLEngine sslEngine)
Get the SSLEngine.

        this.sslEngine = sslEngine;