Examples of SessionMessage


Examples of org.apache.catalina.cluster.SessionMessage

      sessionCounter++;
     
     
      if ( distribute ) {
          SessionMessage msg = new SessionMessage(
              getName(),
              SessionMessage.EVT_SESSION_CREATED,
              null,
              sessionId);
          cluster.send(msg);
View Full Code Here

Examples of org.apache.catalina.cluster.SessionMessage

                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");
                //just to make sure the other server has the context started
//                long timetowait = 20000-mbr.getMemberAliveTime();
View Full Code Here

Examples of org.apache.catalina.cluster.SessionMessage

        */
       public SessionMessage requestCompleted(String sessionId) {
           try {
               DeltaSession session = (DeltaSession) findSession(sessionId);
               DeltaRequest deltaRequest = session.getDeltaRequest();
               SessionMessage msg = null;
               if (deltaRequest.getSize() > 0) {
  
                   byte[] data = unloadDeltaRequest(deltaRequest);
                   msg = new SessionMessage(name, SessionMessage.EVT_SESSION_DELTA,
                                            data, sessionId);
                   session.resetDeltaRequest();
               } else if ( !session.isPrimarySession() ) {
                   msg = new SessionMessage(getName(),
                                         SessionMessage.EVT_SESSION_ACCESSED,
                                         null,
                                         sessionId);
               }
               session.setPrimarySession(true);
View Full Code Here

Examples of org.apache.catalina.cluster.SessionMessage

           }
  
       }
      
       protected void sessionExpired(String id) {
           SessionMessage msg = new SessionMessage(getName(),
                                                   SessionMessage.EVT_SESSION_EXPIRED,
                                                   null,
                                                   id);
           cluster.send(msg);
       }
View Full Code Here

Examples of org.apache.catalina.cluster.SessionMessage

               log.debug("Received SessionMessage of type=" + msg.getEventTypeString()+" from "+sender);
               switch (msg.getEventType()) {
                   case SessionMessage.EVT_GET_ALL_SESSIONS: {
                       //get a list of all the session from this manager
                       byte[] data = doUnload();
                       SessionMessage newmsg = new SessionMessage(name,
                           SessionMessage.EVT_ALL_SESSION_DATA,
                           data, "");
                       cluster.send(newmsg, sender);
                       break;
                   }
View Full Code Here

Examples of org.apache.catalina.cluster.session.SessionMessage

        {
            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());
View Full Code Here

Examples of org.apache.catalina.cluster.session.SessionMessage

                new ReplicationStream(new java.io.ByteArrayInputStream(data),
                                      getClass().getClassLoader());
            Object myobj = stream.readObject();
            if ( myobj != null && myobj instanceof SessionMessage ) {
               
                SessionMessage msg = (SessionMessage)myobj;
                log.debug("Assuming clocks are synched: Replication took="+(System.currentTimeMillis()-msg.getTimestamp())+" ms.");
                String ctxname = msg.getContextName();
                //check if the message is a EVT_GET_ALL_SESSIONS,
                //if so, wait until we are fully started up
                if ( ctxname == null ) {
                    java.util.Iterator i = managers.keySet().iterator();
                    while ( i.hasNext() ) {
View Full Code Here

Examples of org.apache.catalina.cluster.session.SessionMessage

            //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();
View Full Code Here

Examples of org.apache.catalina.cluster.session.SessionMessage

            ReplicationStream stream =
                new ReplicationStream(new java.io.ByteArrayInputStream(data),
                                      getClass().getClassLoader());
            Object myobj = stream.readObject();
            if ( myobj != null && myobj instanceof SessionMessage ) {
                SessionMessage msg = (SessionMessage)myobj;
                //remove when checking in
                perfMessageRecvd(msg.getTimestamp());
                String name = msg.getContextName();
                //check if the message is a EVT_GET_ALL_SESSIONS,
                //if so, wait until we are fully started up
                if ( name == null ) {
                    java.util.Iterator i = managers.keySet().iterator();
                    while ( i.hasNext() ) {
View Full Code Here

Examples of org.apache.catalina.cluster.session.SessionMessage

        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];
                }
            }
            byte[] data = createMessageData(msg);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.