Package org.apache.catalina.cluster

Examples of org.apache.catalina.cluster.Member


    public void send(SessionMessage msg, Member dest) {
        try
        {
            msg.setAddress(service.getLocalMember());
            Member destination = dest;
            if ( (destination == null) && (msg.getEventType() == SessionMessage.EVT_GET_ALL_SESSIONS) ) {
                if (service.getMembers().length > 0)
                    destination = service.getMembers()[0];
            }
            msg.setTimestamp(System.currentTimeMillis());
            java.io.ByteArrayOutputStream outs = new java.io.ByteArrayOutputStream();
            java.io.ObjectOutputStream out = new java.io.ObjectOutputStream(outs);
            out.writeObject(msg);
            byte[] data = outs.toByteArray();
            if(destination != null) {
                  Member tcpdest = dest;
                  if ( (tcpdest != null) && (!service.getLocalMember().equals(tcpdest)))  {
                       mReplicationTransmitter.sendMessage(msg.getSessionID(),
                                                           data,
                                                           InetAddress.getByName(tcpdest.getHost()),
                                                           tcpdest.getPort());
                  }//end if
            }
            else {
                mReplicationTransmitter.sendMessage(msg.getSessionID(),data);
            }
View Full Code Here



    public void memberAdded(Member member) {
        try  {
            log.info("Replication member added:" + member);
            Member mbr = member;
            mReplicationTransmitter.add(IDataSenderFactory.getIDataSender(replicationMode,mbr));
        } catch ( Exception x ) {
            log.error("Unable to connect to replication system.",x);
        }
View Full Code Here

    public void memberDisappeared(Member member)
    {
        log.info("Received member disappeared:"+member);
        try
        {
            Member mbr = member;
            mReplicationTransmitter.remove(InetAddress.getByName(mbr.getHost()),
                                 mbr.getPort());
        }
        catch ( Exception x )
        {
            log.error("Unable remove cluster node from replication system.",x);
        }
View Full Code Here

                log.info("Starting... no cluster associated with this context:"+getName());
                return;
            }

            if (cluster.getMembers().length > 0) {
                Member mbr = cluster.getMembers()[0];
                SessionMessage msg =
                    new SessionMessage(this.getName(),
                                       SessionMessage.EVT_GET_ALL_SESSIONS,
                                       null,
                                       "GET-ALL");
View Full Code Here

    public void send(ClusterMessage msg, Member dest) {
        try
        {
            msg.setAddress(membershipService.getLocalMember());
            Member destination = dest;
           
            if ( msg instanceof SessionMessage ) {
                SessionMessage smsg = (SessionMessage) msg;
                //if we request session state, send to the oldest of members
                if ((destination == null) &&
                    (smsg.getEventType() == SessionMessage.EVT_GET_ALL_SESSIONS) &&
                    (membershipService.getMembers().length > 0)) {
                        destination = membershipService.getMembers()[0];
                }//end if
            }//end if
            msg.setTimestamp(System.currentTimeMillis());
            java.io.ByteArrayOutputStream outs = new java.io.ByteArrayOutputStream();
            java.io.ObjectOutputStream out = new java.io.ObjectOutputStream(outs);
            out.writeObject(msg);
            byte[] data = outs.toByteArray();
            if(destination != null) {
                  Member tcpdest = dest;
                  if ( (tcpdest != null) && (!membershipService.getLocalMember().equals(tcpdest)))  {
                       clusterSender.sendMessage(msg.getUniqueId(), data, tcpdest);
                  }//end if
            }
            else {
View Full Code Here

            getDeployer().remove(contextPath, true);
            //step 1. Install it locally
        getDeployer().install(contextPath, war);
        //step 2. Send it to each member in the cluster
        Member[] members = getCluster().getMembers();
        Member localMember = getCluster().getLocalMember();
        FileMessageFactory factory = FileMessageFactory.getInstance(new File(
            war.getFile()), false);
        FileMessage msg = new FileMessage(localMember, war.getFile(),
                                          contextPath);
        msg = factory.readMessage(msg);
View Full Code Here

        //step 1. Remove it locally
        if (getDeployer().findDeployedApp(contextPath) != null)
            getDeployer().remove(contextPath, undeploy);
            //step 2. Send it to each member in the cluster
        Member[] members = getCluster().getMembers();
        Member localMember = getCluster().getLocalMember();
        UndeployMessage msg = new UndeployMessage(localMember,
                                                  System.currentTimeMillis(),
                                                  "Undeploy:" + contextPath +
                                                  ":" +
                                                  System.currentTimeMillis(),
View Full Code Here

                log.error("Starting... no cluster associated with this context:"+getName());
                return;
            }

            if (cluster.getMembers().length > 0) {
                Member mbr = cluster.getMembers()[0];
                SessionMessage msg =
                    new SessionMessageImpl(this.getName(),
                                       SessionMessage.EVT_GET_ALL_SESSIONS,
                                       null,
                                       "GET-ALL",
View Full Code Here

                return;
            }
            cluster.addManager(getName(),this);

            if (cluster.getMembers().length > 0) {
                Member mbr = cluster.getMembers()[0];
                SessionMessage msg =
                    new SessionMessageImpl(this.getName(),
                                       SessionMessage.EVT_GET_ALL_SESSIONS,
                                       null,
                                       "GET-ALL",
View Full Code Here

        assertEquals(session, manager.findSession(session.getId()));
        for (int i = 0; i < 10; i++) {
            manager.createSession(null,false);
        }
        assertEquals(11,manager.getSessionCounter());
        Member sender = new McastMember("test","d10","localhost",8080,3000);
        MockCluster cluster = new MockCluster ();
        manager.setCluster(cluster);
        manager.setSendAllSessionsSize(2);
        manager.handleGET_ALL_SESSIONS(null,sender);
        // send all session activ - 6 sessions message and one transfer complete
View Full Code Here

TOP

Related Classes of org.apache.catalina.cluster.Member

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.