public void storeSipSessionAttributes(Fqn<String> fqn, OutgoingSessionGranularitySessionData sessionData) { if(sessionData.getSessionAttributes() != null) { if (log_.isDebugEnabled()) { log_.debug("storeSipSessionAttributes(): putting sip session attributes " + sessionData.getSessionAttributes()); String attribLog = "\n"; for(String name : sessionData.getSessionAttributes().keySet()) { attribLog += "ATTRIBUTE(" + name + ") -> " + sessionData.getSessionAttributes().get(name) + "\n"; } log_.debug(attribLog); } cacheWrapper_.put(fqn, ATTRIBUTE_KEY.toString(), getMarshalledValue(sessionData.getSessionAttributes())); } }
private static String maskId(OutgoingSessionGranularitySessionData sessionData) { String realId = (sessionData == null ? null : sessionData.getRealId()); return maskId(realId); }
private int executeReInsert(OutgoingSessionGranularitySessionData session, byte[] obs, Connection conn) throws SQLException, IOException DistributableSessionMetadata metadata = session.getMetadata(); int size = obs.length; InputStream in = null; preparedUpdateSql.setInt(1, session.getVersion()); preparedUpdateSql.setLong(2, session.getTimestamp()); preparedUpdateSql.setString(3, metadata.getId()); preparedUpdateSql.setString(4, metadata.isNew() ? "1" : "0"); preparedUpdateSql.setString(9, session.getRealId()); preparedUpdateSql.setString(10, getName()); int count = preparedUpdateSql.executeUpdate();
DistributableSessionMetadata metadata = sessionData.getMetadata(); if (metadata != null && metadata.isNew()) _conn = null; _conn = safeGetConnection(); if (obs != null && executeGetSessionVersion(_conn, sessionData.getRealId()) != null)
DistributableSessionMetadata metadata = session.getMetadata(); if (metadata == null) 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);
private int executeUpdate(OutgoingSessionGranularitySessionData session, byte[] obs, Connection conn) throws SQLException, IOException DistributableSessionMetadata metadata = session.getMetadata(); int size = obs == null ? -1 : obs.length; InputStream in = null; preparedUpdateSql.setInt(1, session.getVersion()); preparedUpdateSql.setLong(2, session.getTimestamp()); preparedUpdateSql.setString(idParam, session.getRealId()); preparedUpdateSql.setString(idParam + 1, getName()); int count = preparedUpdateSql.executeUpdate();
public void storeSipApplicationSessionAttributes(Fqn<String> fqn, OutgoingSessionGranularitySessionData sessionData) { if(sessionData.getSessionAttributes() != null) { if (log_.isDebugEnabled()) { log_ .debug("storeSipApplicationSessionAttributes(): putting sip app session attributes " + sessionData.getSessionAttributes()); String attribLog = "\n"; for(String name : sessionData.getSessionAttributes().keySet()) { attribLog += "ATTRIBUTE(" + name + ") -> " + sessionData.getSessionAttributes().get(name) + "\n"; } log_.debug(attribLog); } cacheWrapper_.put(fqn, ATTRIBUTE_KEY.toString(), getMarshalledValue(sessionData.getSessionAttributes())); } }
@Override protected void storeSessionAttributes(Map<Object, Object> dataMap, OutgoingSessionGranularitySessionData sessionData) { if(log_.isTraceEnabled()) { Map<String, Object> attrs = sessionData.getSessionAttributes(); if(attrs != null) { for (Entry<String, Object> entry : attrs.entrySet()) { log_.trace("attribute key " + entry.getKey() + ", value=" + entry.getValue()); } } else { log_.trace("attributes null, not replicating"); } } super.storeSessionAttributes(dataMap, sessionData); } }
private byte[] writeSessionAttributes(OutgoingSessionGranularitySessionData session) throws IOException { Map<String, Object> attrs = session.getSessionAttributes(); if (attrs == null) { return null; } ObjectOutputStream oos = null; ByteArrayOutputStream bos = null; try { bos = new ByteArrayOutputStream(); oos = new ObjectOutputStream(new BufferedOutputStream(bos)); oos.writeObject(new SimpleCachableMarshalledValue((Serializable) attrs)); oos.close(); return bos.toByteArray(); } finally { if (oos != null) { oos.close(); } if (bos != null) { bos.close(); } } }
/** * {@inheritDoc} * @see org.jboss.web.tomcat.service.session.distributedcache.ispn.SessionAttributeStorage#store(org.infinispan.atomic.AtomicMap, org.jboss.web.tomcat.service.session.distributedcache.spi.OutgoingDistributableSessionData) */ @Override public void store(Map<Object, Object> map, OutgoingSessionGranularitySessionData sessionData) { Map<String, Object> attributes = sessionData.getSessionAttributes(); if (attributes != null) { SessionMapEntry.ATTRIBUTES.put(map, this.marshaller.marshal(attributes)); } }