Buggy code:
@ Listener ( primaryOnly = true ) public class InfinispanSessionManager < V , L > implements SessionManager < L , TransactionBatch > { private final SessionContext context ; private final Batcher < TransactionBatch > batcher ; private final Cache < String , ? > cache ; private final SessionFactory < V , L > factory ; private final IdentifierFactory < String > identifierFactory ; private final CommandDispatcherFactory dispatcherFactory ; private final NodeFactory < Address > nodeFactory ; private final int maxActiveSessions ; private volatile Time defaultMaxInactiveInterval = new Time ( 30 , TimeUnit . MINUTES ) ; private final boolean persistent ; private final Invoker invoker = new RetryingInvoker ( 0 , 10 , 100 ) ; private final SessionIdentifierFilter filter = new SessionIdentifierFilter ( ) ; volatile CommandDispatcher < Scheduler > dispatcher ; private volatile Scheduler scheduler ; public InfinispanSessionManager ( SessionFactory < V , L > factory , InfinispanSessionManagerConfiguration configuration ) { } @ Override public void start ( ) { } @ Override public void stop ( ) { } boolean isPersistent ( ) { } private void cancel ( ImmutableSession session ) { } void schedule ( ImmutableSession session ) { } private void executeOnPrimaryOwner ( final ImmutableSession session , final Command < Void , Scheduler > command ) throws Exception { } Node locatePrimaryOwner ( ImmutableSession session ) { } @ Override public Batcher < TransactionBatch > getBatcher ( ) { } @ Override public long getDefaultMaxInactiveInterval ( TimeUnit unit ) { } @ Override public void setDefaultMaxInactiveInterval ( long value , TimeUnit unit ) { } @ Override public String createIdentifier ( ) { } @ Override public boolean containsSession ( String id ) { } @ Override public Session < L > findSession ( String id ) { } @ Override public Session < L > createSession ( String id ) { <START_BUG> Session < L > session = this . factory . createSession ( id , this . factory . createValue ( id ) ) ; <END_BUG> final Time time = this . defaultMaxInactiveInterval ; session . getMetaData ( ) . setMaxInactiveInterval ( time . getValue ( ) , time . getUnit ( ) ) ; return new SchedulableSession ( session ) ; } @ Override public ImmutableSession viewSession ( String id ) { } @ Override public Set < String > getActiveSessions ( ) { } @ Override public Set < String > getLocalSessions ( ) { } private Set < String > getSessions ( Flag ... flags ) { } @ CacheEntryActivated public void activated ( CacheEntryActivatedEvent < String , ? > event ) { } @ CacheEntryPassivated public void passivated ( CacheEntryPassivatedEvent < String , ? > event ) { } @ CacheEntryRemoved public void removed ( CacheEntryRemovedEvent < String , ? > event ) { } @ DataRehashed public void dataRehashed ( DataRehashedEvent < String , ? > event ) { } private void schedule ( Cache < String , ? > cache , Locality oldLocality , Locality newLocality ) { } static void triggerPrePassivationEvents ( ImmutableSession session ) { } static void triggerPostActivationEvents ( ImmutableSession session ) { } private static List < HttpSessionActivationListener > findListeners ( ImmutableSession session ) { } private class SchedulableSession implements Session < L > { private final Session < L > session ; SchedulableSession ( Session < L > session ) { } @ Override public String getId ( ) { } @ Override public SessionMetaData getMetaData ( ) { } @ Override public boolean isValid ( ) { } @ Override public void invalidate ( ) { } @ Override public SessionAttributes getAttributes ( ) { } @ Override public SessionContext getContext ( ) { } @ Override public void close ( ) { } @ Override public L getLocalContext ( ) { } } }

Fix:
Session < L > session = this . factory . createSession ( id , this . factory . createValue ( id , null ) ) ;