/** * Store the provided session in memcached if the session was modified * or if the session needs to be relocated. * * @param session * the session to save * @param sessionRelocationRequired * specifies, if the session id was changed due to a memcached failover or tomcat failover. * @return the {@link BackupResultStatus} */ public Future<BackupResult> backupSession( final String sessionId, final boolean sessionIdChanged, final String requestId ) { final MemcachedBackupSession session = _manager.getSessionInternal( sessionId ); if ( session == null ) { if(_log.isDebugEnabled()) _log.debug( "No session found in session map for " + sessionId ); return new SimpleFuture<BackupResult>( BackupResult.SKIPPED ); } _log.info( "Serializing session data for session " + session.getIdInternal() ); final long startSerialization = System.currentTimeMillis(); final byte[] data = _transcoderService.serializeAttributes( (MemcachedBackupSession) session, ((MemcachedBackupSession) session).getAttributesFiltered() ); _log.info( String.format( "Serializing %1$,.3f kb session data for session %2$s took %3$d ms.", (double)data.length / 1000, session.getIdInternal(), System.currentTimeMillis() - startSerialization ) ); _sessionData.put( session.getIdInternal(), data ); _statistics.registerSince( ATTRIBUTES_SERIALIZATION, startSerialization ); _statistics.register( CACHED_DATA_SIZE, data.length ); return new SimpleFuture<BackupResult>( new BackupResult( BackupResultStatus.SUCCESS ) ); }
session.setLastBackupTime( System.currentTimeMillis() ); try { final ConcurrentMap<String, Object> attributes = session.getAttributesFiltered(); final byte[] attributesData = _transcoderService.serializeAttributes( session, attributes ); final byte[] data = _transcoderService.serialize( session, attributesData );
final ConcurrentMap<String, Object> attributes = _session.getAttributesFiltered(); final byte[] attributesData = serializeAttributes( _session, attributes ); final int hashCode = Arrays.hashCode( attributesData );
/** * Store the provided session in memcached if the session was modified * or if the session needs to be relocated. * * @param session * the session to save * @param sessionRelocationRequired * specifies, if the session id was changed due to a memcached failover or tomcat failover. * @return the {@link BackupResultStatus} */ public Future<BackupResult> backupSession( final String sessionId, final boolean sessionIdChanged, final String requestId ) { final MemcachedBackupSession session = _manager.getSessionInternal( sessionId ); if ( session == null ) { if(_log.isDebugEnabled()) _log.debug( "No session found in session map for " + sessionId ); return new SimpleFuture<BackupResult>( BackupResult.SKIPPED ); } _log.info( "Serializing session data for session " + session.getIdInternal() ); final long startSerialization = System.currentTimeMillis(); final byte[] data = _transcoderService.serializeAttributes( (MemcachedBackupSession) session, ((MemcachedBackupSession) session).getAttributesFiltered() ); _log.info( String.format( "Serializing %1$,.3f kb session data for session %2$s took %3$d ms.", (double)data.length / 1000, session.getIdInternal(), System.currentTimeMillis() - startSerialization ) ); _sessionData.put( session.getIdInternal(), data ); _statistics.registerSince( ATTRIBUTES_SERIALIZATION, startSerialization ); _statistics.register( CACHED_DATA_SIZE, data.length ); return new SimpleFuture<BackupResult>( new BackupResult( BackupResultStatus.SUCCESS ) ); }
session.setLastBackupTime( System.currentTimeMillis() ); try { final ConcurrentMap<String, Object> attributes = session.getAttributesFiltered(); final byte[] attributesData = _transcoderService.serializeAttributes( session, attributes ); final byte[] data = _transcoderService.serialize( session, attributesData );
final ConcurrentMap<String, Object> attributes = _session.getAttributesFiltered(); final byte[] attributesData = serializeAttributes( _session, attributes ); final int hashCode = Arrays.hashCode( attributesData );