Buggy code:
@ Listener ( primaryOnly = true ) public class InfinispanBeanManager < G , I , T > implements BeanManager < G , I , T , TransactionBatch > { private final Cache < G , BeanGroupEntry < I , T > > groupCache ; private final String beanName ; private final Cache < BeanKey < I > , BeanEntry < G > > beanCache ; private final BeanFactory < G , I , T > beanFactory ; private final BeanGroupFactory < G , I , T > groupFactory ; private final IdentifierFactory < G > groupIdentifierFactory ; private final IdentifierFactory < I > beanIdentifierFactory ; private final List < KeyAffinityService < ? > > affinityServices = new ArrayList < > ( 2 ) ; private final Registry < String , ? > registry ; private final NodeFactory < Address > nodeFactory ; private final CommandDispatcherFactory dispatcherFactory ; private final ExpirationConfiguration < T > expiration ; private final PassivationConfiguration < T > passivation ; private final AtomicInteger passiveCount = new AtomicInteger ( ) ; private final Batcher < TransactionBatch > batcher ; private final Invoker invoker = new RetryingInvoker ( 0 , 10 , 100 ) ; private final BeanKeyFilter < I > filter ; volatile CommandDispatcher < Scheduler < I > > dispatcher ; private volatile Scheduler < I > scheduler ; public InfinispanBeanManager ( InfinispanBeanManagerConfiguration < T > configuration , final Configuration < I , BeanKey < I > , BeanEntry < G > , BeanFactory < G , I , T > > beanConfiguration , final Configuration < G , G , BeanGroupEntry < I , T > , BeanGroupFactory < G , I , T > > groupConfiguration ) { } @ Override public void start ( ) { } @ Override public void stop ( ) { } @ Override public Affinity getStrictAffinity ( ) { } @ Override public Affinity getWeakAffinity ( I id ) { } private void cancel ( final Bean < G , I , T > bean ) { } void schedule ( final Bean < G , I , T > bean ) { } private void executeOnPrimaryOwner ( final Bean < G , I , T > bean , final Command < Void , Scheduler < I > > command ) throws Exception { } Node locatePrimaryOwner ( I id ) { } @ Override public Bean < G , I , T > createBean ( I id , G groupId , T bean ) { ROOT_LOGGER . tracef ( "Creating<seq2seq4repair_space>bean<seq2seq4repair_space>%s<seq2seq4repair_space>associated<seq2seq4repair_space>with<seq2seq4repair_space>group<seq2seq4repair_space>%s" , id , groupId ) ; <START_BUG> BeanGroup < G , I , T > group = this . groupFactory . createGroup ( groupId , this . groupFactory . createValue ( groupId , null ) ) ; <END_BUG> group . addBean ( id , bean ) ; group . releaseBean ( id , ( this . passivation . isPersistent ( ) ? this . passivation . getPassivationListener ( ) : null ) ) ; return new SchedulableBean ( this . beanFactory . createBean ( id , this . beanFactory . createValue ( id , groupId ) ) ) ; } @ Override public Bean < G , I , T > findBean ( I id ) { } @ Override public boolean containsBean ( I id ) { } @ Override public IdentifierFactory < G > getGroupIdentifierFactory ( ) { } @ Override public IdentifierFactory < I > getBeanIdentifierFactory ( ) { } @ Override public Batcher < TransactionBatch > getBatcher ( ) { } @ Override public int getActiveCount ( ) { } @ Override public int getPassiveCount ( ) { } @ CacheEntryPassivated public void passivated ( CacheEntryPassivatedEvent < BeanKey < I > , BeanEntry < G > > event ) { } @ CacheEntryActivated public void activated ( CacheEntryActivatedEvent < BeanKey < I > , BeanEntry < G > > event ) { } @ DataRehashed public void dataRehashed ( DataRehashedEvent < BeanKey < I > , BeanEntry < G > > event ) { } private void schedule ( Cache < BeanKey < I > , BeanEntry < G > > cache , Locality oldLocality , Locality newLocality ) { } private class SchedulableBean implements Bean < G , I , T > { private final Bean < G , I , T > bean ; SchedulableBean ( Bean < G , I , T > bean ) { } @ Override public I getId ( ) { } @ Override public G getGroupId ( ) { } @ Override public void remove ( RemoveListener < T > listener ) { } @ Override public boolean isExpired ( ) { } @ Override public T acquire ( ) { } @ Override public boolean release ( ) { } @ Override public void close ( ) { } } }

Fix:
BeanGroup < G , I , T > group = this . groupFactory . createGroup ( groupId , this . groupFactory . createValue ( groupId ) ) ;