Package com.sun.enterprise.web.connector.grizzly

Examples of com.sun.enterprise.web.connector.grizzly.SelectorThread


        // Performance optimization used when a single protocol
        // is supported by this Pipeline.
        ProtocolHandler protocolHandler = null;
        boolean cachedHandler = (mappedProtocols != null) &&
                ((protocolHandler = mappedProtocols.get(task.getSelectionKey())) != null);
        SelectorThread selectorThread = task.getSelectorThread();
        KeepAlivePipeline kap = (selectorThread == null) ? null
                : selectorThread.getKeepAlivePipeline();
        if (!isClbSet) {
            String port = task.getSelectorThread().getPort() + "";
            InetAddress inet = task.getSelectorThread().getInet();
           
            // check if the port and address belong to admin listener
            String adminport = ProxyConfig.getInstance().getAdminPort();
            String adminaddress = ProxyConfig.getInstance().getAdminInet();

            boolean isAdminPort = false;
           
            if ((adminport != null) && (adminaddress != null)
                                    && (inet != null)) {
                if (inet.getHostAddress().trim().equalsIgnoreCase(adminaddress) &&
                        port.trim().equals(adminport)) {
                    isAdminPort = true;
                }
                if (isAdminPort) {
                    removeProtocolFinder(sailfinProxyFinder);
                    removeProtocolHandler(sailfinProxyHandler);
                }
                if (logger.isLoggable(Level.FINE)){
                    logger.log(Level.FINE, "clb.proxy.portunif.disable_proxy", disableProxy);
                }
            }           
            isClbSet = true;
        }
        if (protocolFinders.isEmpty() || (kap == null) ||
                protocolHandlers.isEmpty() ||
                (task.getType() != Task.READ_TASK) ||
                (kap.isKeepAlive(task.getSelectionKey()) && !cachedHandler &&
                disableProxy)) {
            if (logger.isLoggable(Level.FINEST)){
                logger.log(Level.FINEST,
                        "clb.proxy.portunif.add_defaulttask");
            }
            super.addTask(task);
           
            return;
        }
        task.getSelectionKey().attach(null);
        if (!isSet) {
            isRequestedTransportSecure = (task.getSelectorThread() instanceof SecureSelector)
            ? true : false;
            isSet = true;
           
            if (isRequestedTransportSecure) {
                sslContext = ((SSLSelectorThread) task.getSelectorThread()).getSSLContext();
            }
           
            if (!isRequestedTransportSecure || (sslContext == null)) {
                if (sslContext == null) {
                    Enumeration<SelectorThread> selectors = SelectorThread.getSelectors();
                    SelectorThread sel;
                   
                    while (selectors.hasMoreElements()) {
                        sel = selectors.nextElement();
                       
                        if (sel instanceof SSLSelectorThread) {
View Full Code Here


    protected synchronized void cancelCometTask(CometTask cometTask){
        if (cometTask == null) return;

        try{
            SelectorThread st = cometTask.getSelectorThread();
            SelectionKey mainKey = cometTask.getSelectionKey();
            if (cometTask.getCometContext() != null) {
                cometTask.getCometContext().interrupt(cometTask);
            }

            cometEngine.interrupt(cometTask);
            st.cancelKey(mainKey);
        } catch (Throwable t) {
            logger.log(Level.SEVERE,"CometSelector",t);
        }
    }
View Full Code Here

            }
        } else {
            System.out.println("lib folder is missing");
        }
       
        SelectorThread selectorThread = null;
        String selectorThreadClassname = System.getProperty(SELECTOR_THREAD);
        if ( selectorThreadClassname != null){
            selectorThread = (SelectorThread)loadInstance(selectorThreadClassname);
        } else {
            selectorThread = new SelectorThread();
            selectorThread
                    .setAlgorithmClassName(StaticStreamAlgorithm.class.getName());
        }       
        selectorThread.setPort(port);
        selectorThread.setWebAppRootPath(folder);
       
        String adapterClass =  System.getProperty(ADAPTER);
        Adapter adapter;
        if (adapterClass == null){
            adapter = new StaticResourcesAdapter();
        } else {
            adapter = (Adapter)loadInstance(adapterClass);
        }

        selectorThread.setAdapter(adapter);
        selectorThread.setDisplayConfiguration(true);
        selectorThread.initEndpoint();
        selectorThread.startEndpoint();
    }
View Full Code Here

   
    public TlsProtocolFinder() {
        // Try to find a secure SelectorThread.
        Enumeration<SelectorThread> selectors
            = SelectorThread.getSelectors();                         
        SelectorThread sel;
        while (selectors.hasMoreElements()){
            sel = selectors.nextElement();
            if (sel instanceof SSLSelectorThread){
                needClientAuth = ((SSLSelectorThread)sel).isNeedClientAuth();
                wantClientAuth = ((SSLSelectorThread)sel).isWantClientAuth()
View Full Code Here

        // is supported by this Pipeline.
        ProtocolHandler protocolHandler = null;
        boolean cachedHandler = mappedProtocols != null
                && (protocolHandler =
                        mappedProtocols.get(task.getSelectionKey())) != null;
        SelectorThread selectorThread = task.getSelectorThread();
        KeepAlivePipeline kap = selectorThread == null ? null :
                                        selectorThread.getKeepAlivePipeline();
        if (protocolFinders.isEmpty()
                || kap == null
                || protocolHandlers.isEmpty()
                || task.getType() != Task.READ_TASK
                || (kap.isKeepAlive(task.getSelectionKey()) && !cachedHandler)){
            super.addTask(task);
            return;
        }
        task.getSelectionKey().attach(null);
       
        if (!isSet) {
            isRequestedTransportSecure =
                (task.getSelectorThread() instanceof SecureSelector)
                    ? true: false;
            isSet = true;
            if (isRequestedTransportSecure){
                sslContext = ((SSLSelectorThread)task.getSelectorThread())
                                .getSSLContext();
            }
           
            if (!isRequestedTransportSecure || sslContext == null) {
                if ( sslContext == null ){
                    Enumeration<SelectorThread> selectors
                        = SelectorThread.getSelectors();                         
                    SelectorThread sel;
                    while (selectors.hasMoreElements()){
                        sel = selectors.nextElement();
                        if (sel instanceof SSLSelectorThread){
                            sslContext =
                                    ((SSLSelectorThread)sel).getSSLContext();
View Full Code Here

   
    private SelectorThread createSelectorThread() throws IOException, InstantiationException {
        final IncomeMessageProcessor messageProcessor = IncomeMessageProcessor.registerListener(port,
                (WSTCPTomcatRegistry) WSTCPTomcatRegistry.getInstance(), null);
       
        final SelectorThread selectorThread = new SelectorThread() {
            @Override
            protected void rampUpProcessorTask() {}
            @Override
            protected void registerComponents() {}
        };
       
        selectorThread.setPort(port);
        if (readThreadsCount > 0) {
            selectorThread.setSelectorReadThreadsCount(readThreadsCount);
        }
       
        if (maxWorkerThreadsCount >= 0) {
            selectorThread.setMaxThreads(maxWorkerThreadsCount);
        }
       
        if (minWorkerThreadsCount >= 0) {
            selectorThread.setMinThreads(minWorkerThreadsCount);
        }
       
        selectorThread.setPipelineClassName(PortUnificationPipeline.class.getName());
        selectorThread.initEndpoint();
       
        PortUnificationPipeline puPipeline = (PortUnificationPipeline) selectorThread.getProcessorPipeline();
        puPipeline.addProtocolFinder(new WSTCPProtocolFinder());
        puPipeline.addProtocolFinder(new TlsProtocolFinder());
        puPipeline.addProtocolFinder(new HttpRedirectorProtocolFinder());
       
        WSTCPProtocolHandler protocolHandler = new WSTCPProtocolHandler();
View Full Code Here

   
    public void listenOnNewPort() throws IOException {
        try {
            IncomeMessageProcessor.registerListener(port, listener, properties);
           
            selectorThread = new SelectorThread();
            selectorThread.setClassLoader(WSTCPStreamAlgorithm.class.getClassLoader());
            selectorThread.setAlgorithmClassName(WSTCPStreamAlgorithm.class.getName());
            selectorThread.setAddress(InetAddress.getByName(host));
            selectorThread.setPort(port);
            selectorThread.setBufferSize(TCPConstants.DEFAULT_FRAME_SIZE);
View Full Code Here

TOP

Related Classes of com.sun.enterprise.web.connector.grizzly.SelectorThread

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.