private MemcachedBackupSession loadFromMemcached( final String sessionId ) {
        if ( _log.isDebugEnabled() ) {
            _log.debug( "Loading session from memcached: " + sessionId );
        }

        LockStatus lockStatus = null;
        try {

            if ( !_sticky ) {
                lockStatus = _lockingStrategy.onBeforeLoadFromMemcached( sessionId );
            }

            final long start = System.currentTimeMillis();

            /* In the previous version (<1.2) the session was completely serialized by
             * custom Transcoder implementations.
             * Such sessions have set the SERIALIZED flag (from SerializingTranscoder) so that
             * they get deserialized by BaseSerializingTranscoder.deserialize or the appropriate
             * specializations.
             */
            final byte[] object = _storage.get( _memcachedNodesManager.getStorageKeyFormat().format( sessionId ) );
            _memcachedNodesManager.onLoadFromMemcachedSuccess( sessionId );

            if ( object != null ) {
                final long startDeserialization = System.currentTimeMillis();
                final MemcachedBackupSession result = _transcoderService.deserialize( object, _manager );
                _statistics.registerSince( SESSION_DESERIALIZATION, startDeserialization );
                _statistics.registerSince( LOAD_FROM_MEMCACHED, start );

                result.setSticky( _sticky );
                if ( !_sticky ) {
                    _lockingStrategy.onAfterLoadFromMemcached( result, lockStatus );
                }

                if ( _log.isDebugEnabled() ) {
                    _log.debug( "Found session with id " + sessionId );
                }
                return result;
            }
            else {
                releaseIfLocked( sessionId, lockStatus );
                _invalidSessionsCache.put( sessionId, Boolean.TRUE );
                if ( _log.isDebugEnabled() ) {
                    _log.debug( "Session " + sessionId + " not found in memcached." );
                }
                return null;
            }
        } catch ( final TranscoderDeserializationException e ) {
            _log.warn( "Could not deserialize session with id " + sessionId + " from memcached, session will be purged from storage.", e );
            releaseIfLocked( sessionId, lockStatus );
            _storage.delete( _memcachedNodesManager.getStorageKeyFormat().format(sessionId) );
            _invalidSessionsCache.put( sessionId, Boolean.TRUE );
        } catch ( final Exception e ) {
            _log.warn( "Could not load session with id " + sessionId + " from memcached.", e );
            releaseIfLocked( sessionId, lockStatus );
        } finally {
        }
        return null;
    }
private MemcachedBackupSession loadFromMemcached ( final String sessionId ) { if ( _log . isDebugEnabled ( ) ) { _log . debug ( "Loading session from memcached: " + sessionId ) ; } LockStatus lockStatus = null ; try { if ( ! _sticky ) { lockStatus = _lockingStrategy . onBeforeLoadFromMemcached ( sessionId ) ; } final long start = System . currentTimeMillis ( ) ; final byte [ ] object = _storage . get ( _memcachedNodesManager . getStorageKeyFormat ( ) . format ( sessionId ) ) ; _memcachedNodesManager . onLoadFromMemcachedSuccess ( sessionId ) ; if ( object != null ) { final long startDeserialization = System . currentTimeMillis ( ) ; final MemcachedBackupSession result = _transcoderService . deserialize ( object , _manager ) ; _statistics . registerSince ( SESSION_DESERIALIZATION , startDeserialization ) ; _statistics . registerSince ( LOAD_FROM_MEMCACHED , start ) ; result . setSticky ( _sticky ) ; if ( ! _sticky ) { _lockingStrategy . onAfterLoadFromMemcached ( result , lockStatus ) ; } if ( _log . isDebugEnabled ( ) ) { _log . debug ( "Found session with id " + sessionId ) ; } return result ; } else { releaseIfLocked ( sessionId , lockStatus ) ; _invalidSessionsCache . put ( sessionId , Boolean . TRUE ) ; if ( _log . isDebugEnabled ( ) ) { _log . debug ( "Session " + sessionId + " not found in memcached." ) ; } return null ; } } catch ( final TranscoderDeserializationException e ) { _log . warn ( "Could not deserialize session with id " + sessionId + " from memcached, session will be purged from storage." , e ) ; releaseIfLocked ( sessionId , lockStatus ) ; _storage . delete ( _memcachedNodesManager . getStorageKeyFormat ( ) . format ( sessionId ) ) ; _invalidSessionsCache . put ( sessionId , Boolean . TRUE ) ; } catch ( final Exception e ) { _log . warn ( "Could not load session with id " + sessionId + " from memcached." , e ) ; releaseIfLocked ( sessionId , lockStatus ) ; } finally { } return null ; }
Assumes that before you checked {@link #canHitMemcached(String)}.