Package org.jboss.web.tomcat.service.session.distributedcache.spi

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


            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

    * 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

      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

      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

     
      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

     
      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(2);
      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

               if (getLogger().isTraceEnabled())
               {
                  getLogger().trace("Loading session " + maskId(realId));
               }

               DistributableSessionMetadata metadata = new DistributableSessionMetadata();

               metadata.setId(rst.getString(1));
               metadata.setCreationTime(rst.getLong(2));
               String isNew = rst.getString(3);
               metadata.setNew("1".equals(isNew));
               metadata.setMaxInactiveInterval(rst.getInt(4));
               String valid = rst.getString(7);
               metadata.setValid("1".equals(valid));
//               metadata.setValid(true);

               Integer version = Integer.valueOf(rst.getInt(5));
               Long timestamp = Long.valueOf(rst.getLong(6));
View Full Code Here

         try
         {
            byte[] obs = writeSessionAttributes(sessionData);

            DistributableSessionMetadata metadata = sessionData.getMetadata();
            if (metadata != null && metadata.isNew())
            {
               try
               {
                  executeInsert(sessionData, obs, _conn);
               }
View Full Code Here

      if (obs == null)
      {
         obs = this.emptyAttributes;
      }

      DistributableSessionMetadata metadata = session.getMetadata();
      if (metadata == null)
      {
         throw new IllegalStateException("Cannot insert session " + maskId(session) + " as session metadata is missing");
      }

      int size = obs.length;
      ByteArrayInputStream bis = new ByteArrayInputStream(obs);
      InputStream in = new BufferedInputStream(bis, size);

      try
      {
         PreparedStatement preparedInsertSql = prepareStatement(conn, getInsertSql());
         preparedInsertSql.setString(1, getName());
         preparedInsertSql.setString(2, session.getRealId());
         preparedInsertSql.setString(3, metadata.getId());
         preparedInsertSql.setLong(4, metadata.getCreationTime());
         preparedInsertSql.setString(5, metadata.isNew() ? "1" : "0");
         preparedInsertSql.setInt(6, metadata.getMaxInactiveInterval());
         preparedInsertSql.setInt(7, session.getVersion());
         preparedInsertSql.setLong(8, session.getTimestamp());
         preparedInsertSql.setString(9, metadata.isValid() ? "1" : "0");
         preparedInsertSql.setBinaryStream(10, in, size);
         preparedInsertSql.execute();
      }
      finally
      {
View Full Code Here

TOP

Related Classes of org.jboss.web.tomcat.service.session.distributedcache.spi.DistributableSessionMetadata

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.