Examples of DistributableSessionMetadata


Examples of org.jboss.as.clustering.web.DistributableSessionMetadata

            for (Map.Entry<String, String> entry : sessions.entrySet()) {
                String realId = entry.getKey();
                String owner = entry.getValue();

                long ts = -1;
                DistributableSessionMetadata md = null;
                try {
                    IncomingDistributableSessionData sessionData = this.distributedCacheManager.getSessionData(realId, owner, false);
                    if (sessionData == null) {
                        log.debug("Metadata unavailable for unloaded session " + realId);
                        continue;
                    }
                    ts = sessionData.getTimestamp();
                    md = sessionData.getMetadata();
                } catch (Exception e) {
                    // most likely a lock conflict if the session is being updated remotely;
                    // ignore it and use default values for timstamp and maxInactive
                    log.debug("Problem reading metadata for session " + realId + " -- " + e.toString(), e);
                }

                long lastMod = ts == -1 ? System.currentTimeMillis() : ts;
                int maxLife = md == null ? getMaxInactiveInterval() : md.getMaxInactiveInterval();

                OwnedSessionUpdate osu = new OwnedSessionUpdate(owner, lastMod, maxLife, false);
                unloadedSessions.put(realId, osu);
            }
View Full Code Here

Examples of org.jboss.as.clustering.web.DistributableSessionMetadata

                removeAttrs = new HashSet<String>(attrRemovedSet_);
            }

            clearAttrChangedMaps();
        }
        DistributableSessionMetadata metadata = isSessionMetadataDirty() ? getSessionMetadata() : null;
        Long timestamp = modAttrs != null || removeAttrs != null || metadata != null || getMustReplicateTimestamp() ? Long
                .valueOf(getSessionTimestamp()) : null;
        return new OutgoingData(getRealId(), getVersion(), timestamp, metadata, modAttrs, removeAttrs);
    }
View Full Code Here

Examples of org.jboss.as.clustering.web.DistributableSessionMetadata

        long ts = sessionData.getTimestamp();
        this.lastAccessedTime = this.thisAccessedTime = ts;
        this.timestamp.set(ts);

        DistributableSessionMetadata md = sessionData.getMetadata();
        // TODO -- get rid of these field and delegate to metadata
        this.id = md.getId();
        this.creationTime = md.getCreationTime();
        this.maxInactiveInterval = md.getMaxInactiveInterval();
        this.isNew = md.isNew();
        this.isValid = md.isValid();
        this.metadata = md;

        // Get our id without any jvmRoute appended
        parseRealId(id);
View Full Code Here

Examples of org.jboss.as.clustering.web.DistributableSessionMetadata

            for (Map.Entry<String, String> entry : sessions.entrySet()) {
                String realId = entry.getKey();
                String owner = entry.getValue();

                long ts = -1;
                DistributableSessionMetadata md = null;
                try {
                    IncomingDistributableSessionData sessionData = this.distributedCacheManager.getSessionData(realId, owner, false);
                    if (sessionData == null) {
                        log.debugf("Metadata unavailable for unloaded session %s", realId);
                        continue;
                    }
                    ts = sessionData.getTimestamp();
                    md = sessionData.getMetadata();
                } catch (Exception e) {
                    // most likely a lock conflict if the session is being updated remotely;
                    // ignore it and use default values for timestamp and maxInactive
                    log.debug("Problem reading metadata for session " + realId + " -- " + e.toString(), e);
                }

                long lastMod = ts == -1 ? System.currentTimeMillis() : ts;
                int maxLife = md == null ? getMaxInactiveInterval() : md.getMaxInactiveInterval();

                OwnedSessionUpdate osu = new OwnedSessionUpdate(owner, lastMod, maxLife, false);
                unloadedSessions.put(realId, osu);
            }
View Full Code Here

Examples of org.jboss.web.tomcat.service.session.distributedcache.spi.DistributableSessionMetadata

     
      long ts = sessionData.getTimestamp();
      this.lastAccessedTime = this.thisAccessedTime = ts;
      this.timestamp.set(ts);
     
      DistributableSessionMetadata md = sessionData.getMetadata();
      // TODO -- get rid of these field and delegate to metadata
      this.id = md.getId();
      this.creationTime = md.getCreationTime();
      this.maxInactiveInterval = md.getMaxInactiveInterval();
      this.isNew = md.isNew();
      this.isValid = md.isValid();
      this.metadata = md;
     
      // Get our id without any jvmRoute appended
      parseRealId(id);
     
View Full Code Here

Examples of org.jboss.web.tomcat.service.session.distributedcache.spi.DistributableSessionMetadata

            removeAttrs = new HashSet<String>(attrRemovedSet_);
         }
        
         clearAttrChangedMaps();
      }
      DistributableSessionMetadata metadata = isSessionMetadataDirty() ? getSessionMetadata() : null;
      Long timestamp = modAttrs != null || removeAttrs != null || metadata != null || getMustReplicateTimestamp() ? Long.valueOf(getSessionTimestamp()) : null;
      return new OutgoingData(getRealId(), getVersion(), timestamp, metadata, modAttrs, removeAttrs);
   }
View Full Code Here

Examples of org.jboss.web.tomcat.service.session.distributedcache.spi.DistributableSessionMetadata

    * Test method for {@link org.jboss.web.tomcat.service.session.persistent.RDBMSStoreBase#storeSessionData(org.jboss.web.tomcat.service.session.distributedcache.spi.OutgoingSessionGranularitySessionData)}.
    */
   public void testSimpleUpdateSessionData()
   {
      testee.start();
      DistributableSessionMetadata md = new DistributableSessionMetadata();
      String id = nextId();
      md.setId(id + ".full");
      md.setCreationTime(System.currentTimeMillis());
      md.setNew(true);
      md.setValid(true);
      md.setMaxInactiveInterval(30000);
      Long ts = Long.valueOf(md.getCreationTime() + 1);
      Map<String, Object> attrs = new HashMap<String, Object>();
      attrs.put("key", "value");
      OutgoingSessionGranularitySessionData sessionData = new MockOutgoingSessionData(id, 1, ts, md, attrs);
      testee.storeSessionData(sessionData);
     
      ts = Long.valueOf(System.currentTimeMillis());
      sessionData = new MockOutgoingSessionData(id, 1, ts, null, null);
      testee.storeSessionData(sessionData);
     
      IncomingDistributableSessionData incoming = testee.getSessionData(id, true);
      assertEquals(1, incoming.getVersion());
      assertEquals(ts.longValue(), incoming.getTimestamp());
      assertEquals(md.getId(), incoming.getMetadata().getId());
      assertEquals(md.getCreationTime(), incoming.getMetadata().getCreationTime());
      assertEquals(md.isNew(), incoming.getMetadata().isNew());
      assertEquals(md.isValid(), incoming.getMetadata().isValid());
      assertEquals(md.getMaxInactiveInterval(), incoming.getMetadata().getMaxInactiveInterval());
      assertTrue(incoming.providesSessionAttributes());
      assertEquals(attrs, incoming.getSessionAttributes());
   }
View Full Code Here

Examples of org.jboss.web.tomcat.service.session.distributedcache.spi.DistributableSessionMetadata

      testee.start();
      String id = nextId();
     
      assertNull(testee.getSessionTimestamp(id));
     
      DistributableSessionMetadata md = new DistributableSessionMetadata();
      md.setId(id + ".full");
      md.setCreationTime(System.currentTimeMillis());
      md.setNew(true);
      md.setValid(true);
      md.setMaxInactiveInterval(30000);
      Long ts = Long.valueOf(md.getCreationTime() + 1);
      Map<String, Object> attrs = new HashMap<String, Object>();
      attrs.put("key", "value");
      OutgoingSessionGranularitySessionData sessionData = new MockOutgoingSessionData(id, 1, ts, md, attrs);
      testee.storeSessionData(sessionData);
     
View Full Code Here

Examples of org.jboss.web.tomcat.service.session.distributedcache.spi.DistributableSessionMetadata

      testee.start();
      String id = nextId();
     
      assertNull(testee.getSessionVersion(id));
     
      DistributableSessionMetadata md = new DistributableSessionMetadata();
      md.setId(id + ".full");
      md.setCreationTime(System.currentTimeMillis());
      md.setNew(true);
      md.setValid(true);
      md.setMaxInactiveInterval(30000);
      Long ts = Long.valueOf(md.getCreationTime() + 1);
      Map<String, Object> attrs = new HashMap<String, Object>();
      attrs.put("key", "value");
      OutgoingSessionGranularitySessionData sessionData = new MockOutgoingSessionData(id, 1, ts, md, attrs);
      testee.storeSessionData(sessionData);
     
View Full Code Here

Examples of org.jboss.web.tomcat.service.session.distributedcache.spi.DistributableSessionMetadata

     
      testee.clear();
     
      int existing = testee.getSize();
     
      DistributableSessionMetadata md = new DistributableSessionMetadata();
      String id = nextId();
      md.setId(id + ".full");
      md.setCreationTime(System.currentTimeMillis());
      md.setNew(true);
      md.setValid(true);
      md.setMaxInactiveInterval(1);
      Long ts = Long.valueOf(md.getCreationTime() + 1);
      Map<String, Object> attrs = new HashMap<String, Object>();
      attrs.put("key", "value");
      OutgoingSessionGranularitySessionData sessionData = new MockOutgoingSessionData(id, 0, ts, md, attrs);
      testee.storeSessionData(sessionData);
     
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.