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

SSLSelectorReadThread

public class SSLSelectorReadThread extends SSLSelectorThread implements com.sun.enterprise.web.connector.grizzly.MultiSelectorThread
Specialized SelectorThread that only handle OP_READ over SSL.
author
Jean-Francois Arcand

Fields Summary
ArrayList
channels
List of Channel to process.
public static int
countName
Int used to differenciate thsi instance
Constructors Summary
Methods Summary
public synchronized voidaddChannel(java.nio.channels.SocketChannel channel)
Add a Channel to be processed by this Selector


    
                  
         
               
        channels.add(channel);
        getSelector().wakeup();
    
public intgetCurrentBusyProcessorThreads()
Provides the count of request threads that are currently being processed by the container

return
Count of requests

        return (getProcessorPipeline().getCurrentThreadsBusy());
    
public voidinitEndpoint()
Initialize this SelectorThread

 
        setName("SSLSelectorReaderThread-" + getPort());
        initAlgorithm();
    
private synchronized voidregisterNewChannels()
Register all Channel with an OP_READ opeation.

        int size = channels.size();
        for (int i = 0; i < size; i++) {
            SocketChannel sc = channels.get(i);
            sc.configureBlocking(false);
            try {
                SelectionKey readKey = 
                        sc.register(getSelector(), SelectionKey.OP_READ);
                setSocketOptions(((SocketChannel)readKey.channel()).socket());
            } catch (ClosedChannelException cce) {
            }
        }
        channels.clear();
    
public voidstartEndpoint()
Start and wait for incoming connection

        setRunning(true);
        while (isRunning()) {
            try{
                if (getSelector() == null){
                    setSelector(Selector.open());
                }              
                
                registerNewChannels();
                doSelect();
            } catch (Throwable t){
                logger.log(Level.FINE,"selectorThread.errorOnRequest",t);
            }
        }