Package org.apache.catalina.cluster.tcp

Examples of org.apache.catalina.cluster.tcp.SimpleTcpCluster$MemberComparator


                + LF.LINE_SEPARATOR + "</Host>" + LF.LINE_SEPARATOR;
        check(aspectedResult);
    }

    public void testClusterEmpty() throws Exception {
        CatalinaCluster cluster = new SimpleTcpCluster();
        standardHost.setCluster(cluster);
        String aspectedResult = "<Host"
                + LF.LINE_SEPARATOR
                + "    name=\"localhost\">"
                + LF.LINE_SEPARATOR
View Full Code Here


                + "</Host>" + LF.LINE_SEPARATOR;
        check(aspectedResult);
    }

    public void testCluster() throws Exception {
        SimpleTcpCluster cluster = new SimpleTcpCluster();
        cluster.setClusterName("cluster");
        cluster.setExpireSessionsOnShutdown(false);
        cluster.setPrintToScreen(false);
        cluster
                .setManagerClassName("org.apache.catalina.cluster.session.DeltaManager");
        McastService service = new McastService();
        service.setMcastAddr("228.0.0.4");
        service.setMcastPort(45564);
        service.setMcastFrequency(500l);
        service.setMcastDropTime(3000l);
        cluster.setMembershipService(service);
        ReplicationListener receiver = new ReplicationListener();
        receiver.setTcpListenAddress("auto");
        receiver.setTcpListenPort(4001);
        receiver.setTcpSelectorTimeout(100l);
        receiver.setTcpThreadCount(6);
        cluster.setClusterReceiver(receiver);
        ReplicationTransmitter sender = new ReplicationTransmitter();
        sender.setReplicationMode("pooled");
        cluster.setClusterSender(sender);
        ReplicationValve valve = new ReplicationValve();
        valve
                .setFilter(".*\\.gif;.*\\.js;.*\\.jpg;.*\\.jpeg;.*\\.htm;.*\\.html;.*\\.txt;");
        cluster.addValve(valve);
        FarmWarDeployer deployer = new FarmWarDeployer();
        deployer.setTempDir("/tmp/war-temp/");
        deployer.setDeployDir("/tmp/war-deploy/");
        deployer.setWatchDir("/tmp/war-listen/");
        deployer.setWatchEnabled(false);
        cluster.setClusterDeployer(deployer);
        standardHost.setCluster(cluster);
        // DeltaManager is default!
        String aspectedResult = "<Host"
                + LF.LINE_SEPARATOR
                + "    name=\"localhost\">"
View Full Code Here

            long start = System.currentTimeMillis();
            HttpRequest hrequest = (HttpRequest) request;
            HttpServletRequest hreq = (HttpServletRequest) hrequest.getRequest();
            HttpSession session = hreq.getSession(false);
            SimpleTcpReplicationManager manager = (SimpleTcpReplicationManager)request.getContext().getManager();
            SimpleTcpCluster cluster = (SimpleTcpCluster)getContainer().getCluster();
            if ( cluster == null ) {
                log("No cluster configured for this request.",2);
                return;
            }
            //first check for session invalidations
            String[] invalidIds=manager.getInvalidatedSessions();
            if ( invalidIds.length > 0 ) {
                for ( int i=0;i<invalidIds.length; i++ ) {
                    try {
                        SessionMessage imsg = manager.requestCompleted(
                            invalidIds[i]);
                        if (imsg != null)
                            cluster.send(imsg);
                    }catch ( Exception x ) {
                        log("Unable to send session invalid message over cluster.",x,2);
                    }
                }
            }
           
            String id = null;
            if ( session != null )
                id = session.getId();
            else
                return;

            if ( id == null )
                return;

            if ( (request.getContext().getManager()==null) ||
                 (!(request.getContext().getManager() instanceof SimpleTcpReplicationManager)))
                return;

           

            String uri = hrequest.getDecodedRequestURI();
            boolean filterfound = false;

            for ( int i=0; (i<reqFilters.length) && (!filterfound); i++ )
            {
                java.util.regex.Matcher matcher = reqFilters[i].matcher(uri);
                filterfound = matcher.matches();
            }//for
            if ( filterfound )
                return;

            if ( debug > 4 ) log("Invoking replication request on "+uri,4);
           
            SessionMessage msg = manager.requestCompleted(id);
            if ( msg == null ) return;

           
            cluster.send(msg);
            long stop = System.currentTimeMillis();
            addClusterSendTime(stop-start);
           
        }catch (Exception x)
        {
View Full Code Here

            HttpSession session = hreq.getSession(false);
           
            if (!( request.getContext().getManager() instanceof ClusterManager) ) return;
           
            ClusterManager manager = (ClusterManager)request.getContext().getManager();
            SimpleTcpCluster cluster = (SimpleTcpCluster)getContainer().getCluster();
            if ( cluster == null ) {
                log.warn("No cluster configured for this request.");
                return;
            }
            //first check for session invalidations
            String[] invalidIds=manager.getInvalidatedSessions();
            if ( invalidIds.length > 0 ) {
                for ( int i=0;i<invalidIds.length; i++ ) {
                    try {
                        SessionMessage imsg = manager.requestCompleted(
                            invalidIds[i]);
                        if (imsg != null)
                            cluster.send(imsg);
                    }catch ( Exception x ) {
                        log.error("Unable to send session invalid message over cluster.",x);
                    }
                }
            }

            String id = null;
            if ( session != null )
                id = session.getId();
            else
                return;

            if ( id == null )
                return;

            if ( (request.getContext().getManager()==null) ||
                 (!(request.getContext().getManager() instanceof ClusterManager)))
                return;



            String uri = hrequest.getDecodedRequestURI();
            boolean filterfound = false;

            for ( int i=0; (i<reqFilters.length) && (!filterfound); i++ )
            {
                java.util.regex.Matcher matcher = reqFilters[i].matcher(uri);
                filterfound = matcher.matches();
            }//for
            if ( filterfound )
                return;

            log.debug("Invoking replication request on "+uri);

           
            SessionMessage msg = manager.requestCompleted(id);

            if ( msg == null ) return;

            cluster.send(msg);
            long stop = System.currentTimeMillis();
            addClusterSendTime(stop-start);

        }catch (Exception x)
        {
View Full Code Here

            if ( debug > 4 ) log("Invoking replication request on "+uri,4);
            SimpleTcpReplicationManager manager = (SimpleTcpReplicationManager)request.getContext().getManager();
            SessionMessage msg = manager.requestCompleted(id);
            if ( msg == null ) return;

            SimpleTcpCluster cluster = (SimpleTcpCluster)getContainer().getCluster();
            if ( cluster == null ) {
                log("No cluster configured for this request.",2);
                return;
            }
            cluster.send(msg);
        }catch (Exception x)
        {
            log("Unable to perform replication request.",x,2);
        }
    }
View Full Code Here

                + LF.LINE_SEPARATOR + "</Host>" + LF.LINE_SEPARATOR;
        check(aspectedResult);
    }

    public void testClusterEmpty() throws Exception {
        CatalinaCluster cluster = new SimpleTcpCluster();
        standardHost.setCluster(cluster);
        String aspectedResult = "<Host"
                + LF.LINE_SEPARATOR
                + "    name=\"localhost\">"
                + LF.LINE_SEPARATOR
View Full Code Here

                + "</Host>" + LF.LINE_SEPARATOR;
        check(aspectedResult);
    }

    public void testCluster() throws Exception {
        SimpleTcpCluster cluster = new SimpleTcpCluster();
        cluster.setClusterName("cluster");
        cluster.setProperty("expireSessionsOnShutdown","false");
        cluster
                .setManagerClassName("org.apache.catalina.cluster.session.DeltaManager");
        McastService service = new McastService();
        service.setMcastAddr("228.0.0.4");
        service.setMcastPort(45564);
        service.setMcastFrequency(500l);
        service.setMcastDropTime(3000l);
        cluster.setMembershipService(service);
        ReplicationListener receiver = new ReplicationListener();
        receiver.setTcpListenAddress("auto");
        receiver.setTcpListenPort(4001);
        receiver.setTcpSelectorTimeout(100l);
        receiver.setTcpThreadCount(6);
        cluster.setClusterReceiver(receiver);
        ReplicationTransmitter sender = new ReplicationTransmitter();
        sender.setReplicationMode("pooled");
        cluster.setClusterSender(sender);
        ReplicationValve valve = new ReplicationValve();
        valve
                .setFilter(".*\\.gif;.*\\.js;.*\\.jpg;.*\\.jpeg;.*\\.htm;.*\\.html;.*\\.txt;");
        cluster.addValve(valve);
        FarmWarDeployer deployer = new FarmWarDeployer();
        deployer.setTempDir("/tmp/war-temp/");
        deployer.setDeployDir("/tmp/war-deploy/");
        deployer.setWatchDir("/tmp/war-listen/");
        deployer.setWatchEnabled(false);
        cluster.setClusterDeployer(deployer);
        standardHost.setCluster(cluster);
        cluster.addLifecycleListener(new InfoLifecycleListener());
        cluster.addClusterListener(new JvmRouteSessionIDBinderListener());
        // DeltaManager is default!
        String aspectedResult = "<Host"
                + LF.LINE_SEPARATOR
                + "    name=\"localhost\">"
                + LF.LINE_SEPARATOR
View Full Code Here

                + LF.LINE_SEPARATOR + "</Host>" + LF.LINE_SEPARATOR;
        check(aspectedResult);
    }

    public void testClusterEmpty() throws Exception {
        CatalinaCluster cluster = new SimpleTcpCluster();
        standardHost.setCluster(cluster);
        String aspectedResult = "<Host"
                + LF.LINE_SEPARATOR
                + "    name=\"localhost\">"
                + LF.LINE_SEPARATOR
View Full Code Here

                + "</Host>" + LF.LINE_SEPARATOR;
        check(aspectedResult);
    }

    public void testCluster() throws Exception {
        SimpleTcpCluster cluster = new SimpleTcpCluster();
        cluster.setClusterName("cluster");
        cluster.setProperty("expireSessionsOnShutdown","false");
        cluster
                .setManagerClassName("org.apache.catalina.cluster.session.DeltaManager");
        McastService service = new McastService();
        service.setMcastAddr("228.0.0.4");
        service.setMcastPort(45564);
        service.setMcastFrequency(500l);
        service.setMcastDropTime(3000l);
        cluster.setMembershipService(service);
        ReplicationListener receiver = new ReplicationListener();
        receiver.setTcpListenAddress("auto");
        receiver.setTcpListenPort(4001);
        receiver.setTcpSelectorTimeout(100l);
        receiver.setTcpThreadCount(6);
        cluster.setClusterReceiver(receiver);
        ReplicationTransmitter sender = new ReplicationTransmitter();
        sender.setReplicationMode("pooled");
        cluster.setClusterSender(sender);
        ReplicationValve valve = new ReplicationValve();
        valve
                .setFilter(".*\\.gif;.*\\.js;.*\\.jpg;.*\\.jpeg;.*\\.htm;.*\\.html;.*\\.txt;");
        cluster.addValve(valve);
        FarmWarDeployer deployer = new FarmWarDeployer();
        deployer.setTempDir("/tmp/war-temp/");
        deployer.setDeployDir("/tmp/war-deploy/");
        deployer.setWatchDir("/tmp/war-listen/");
        deployer.setWatchEnabled(false);
        cluster.setClusterDeployer(deployer);
        standardHost.setCluster(cluster);
        cluster.addLifecycleListener(new InfoLifecycleListener());
        cluster.addClusterListener(new JvmRouteSessionIDBinderListener());
        // DeltaManager is default!
        String aspectedResult = "<Host"
                + LF.LINE_SEPARATOR
                + "    name=\"localhost\">"
                + LF.LINE_SEPARATOR
View Full Code Here

            if ( (request.getContext().getManager()==null) ||
                 (!(request.getContext().getManager() instanceof SimpleTcpReplicationManager)))
                return;

            SimpleTcpCluster cluster = (SimpleTcpCluster)getContainer().getCluster();
            if ( cluster == null ) {
                log("No cluster configured for this request.",2);
                return;
            }

            String uri = hrequest.getDecodedRequestURI();
            boolean filterfound = false;

            for ( int i=0; (i<reqFilters.length) && (!filterfound); i++ )
            {
                java.util.regex.Matcher matcher = reqFilters[i].matcher(uri);
                filterfound = matcher.matches();
            }//for
            if ( filterfound )
                return;

            if ( debug > 4 ) log("Invoking replication request on "+uri,4);
            SimpleTcpReplicationManager manager = (SimpleTcpReplicationManager)request.getContext().getManager();
            SessionMessage msg = manager.requestCompleted(id);
            if ( msg == null ) return;

           
            cluster.send(msg);
            long stop = System.currentTimeMillis();
            addClusterSendTime(stop-start);
           
        }catch (Exception x)
        {
View Full Code Here

TOP

Related Classes of org.apache.catalina.cluster.tcp.SimpleTcpCluster$MemberComparator

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.