Examples of SessionMessage


Examples of org.apache.catalina.cluster.SessionMessage

     
      sessionCounter++;
     
     
      if ( distribute ) {
          SessionMessage msg = new SessionMessageImpl(
              getName(),
              SessionMessage.EVT_SESSION_CREATED,
              null,
              sessionId,
              sessionId+System.currentTimeMillis());
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 SessionMessageImpl(this.getName(),
                                       SessionMessage.EVT_GET_ALL_SESSIONS,
                                       null,
                                       "GET-ALL",
                                       "GET-ALL-"+getName());
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 SessionMessageImpl(name, SessionMessage.EVT_SESSION_DELTA,
                                            data, sessionId,
View Full Code Here

Examples of org.apache.catalina.cluster.SessionMessage

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

Examples of org.apache.catalina.cluster.SessionMessage

                   case SessionMessage.EVT_GET_ALL_SESSIONS: {
                       //get a list of all the session from this manager
                       log.debug("Manager ("+name+") unloading sessions");
                       byte[] data = doUnload();
                       log.debug("Manager ("+name+") unloading sessions complete");
                       SessionMessage newmsg = new SessionMessageImpl(name,
                           SessionMessage.EVT_ALL_SESSION_DATA,
                           data, "SESSION-STATE","SESSION-STATE-"+getName());
                       cluster.send(newmsg, sender);
                       break;
                   }
View Full Code Here

Examples of org.apache.catalina.cluster.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.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.SessionMessage

        try
        {
            if ( invalidatedSessions.get(sessionId) != null ) {
                synchronized ( invalidatedSessions ) {
                    invalidatedSessions.remove(sessionId);
                    SessionMessage msg = new SessionMessageImpl(name,
                    SessionMessage.EVT_SESSION_EXPIRED,
                    null,
                    sessionId,
                    sessionId);
                return msg;
                }
            } else {
                ReplicatedSession session = (ReplicatedSession) findSession(
                    sessionId);
                if (session != null) {
                    //return immediately if the session is not dirty
                    if (useDirtyFlag && (!session.isDirty())) {
                        //but before we return doing nothing,
                        //see if we should send
                        //an updated last access message so that
                        //sessions across cluster dont expire
                        long interval = session.getMaxInactiveInterval();
                        long lastaccdist = System.currentTimeMillis() -
                            session.getLastAccessWasDistributed();
                        if ( ((interval*1000) / lastaccdist)< 3 ) {
                            SessionMessage accmsg = new SessionMessageImpl(name,
                                SessionMessage.EVT_SESSION_ACCESSED,
                                null,
                                sessionId,
                                sessionId);
                            session.setLastAccessWasDistributed(System.currentTimeMillis());
                            return accmsg;
                        }
                        return null;
                    }

                    session.setIsDirty(false);
                    if (log.isDebugEnabled()) {
                        try {
                            log.debug("Sending session to cluster=" + session);
                        }
                        catch (Exception ignore) {}
                    }
                    SessionMessage msg = new SessionMessageImpl(name,
                        SessionMessage.EVT_SESSION_CREATED,
                        writeSession(session),
                        session.getId(),
                        session.getId());
                    return 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 SessionMessageImpl(this.getName(),
                                       SessionMessage.EVT_GET_ALL_SESSIONS,
                                       null,
                                       "GET-ALL",
                                       "GET-ALL-"+this.getName());
View Full Code Here

Examples of org.apache.catalina.cluster.SessionMessage

                    }//for
                    //don't send a message if we don't have to
                    oout.flush();
                    oout.close();
                    byte[] data = bout.toByteArray();
                    SessionMessage newmsg = new SessionMessageImpl(name,
                        SessionMessage.EVT_ALL_SESSION_DATA,
                        data, "SESSION-STATE","SESSION-STATE-"+getName());
                    cluster.send(newmsg, sender);
                    break;
                }
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.