@Test public void newReplicantSession() { final TestReplicantSessionManager sm = new TestReplicantSessionManager(); final ReplicantSession session = createSession( sm ); assertTrue( session.getId().matches( "[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}" ) ); }
@Override @Nonnull public ReplicantSession createSession( @Nonnull final Session webSocketSession ) { final ReplicantSession session = new ReplicantSession( webSocketSession ); _lock.writeLock().lock(); try { _sessions.put( session.getId(), session ); } finally { _lock.writeLock().unlock(); } return session; }
ReplicantSessionManagerImpl implements EntityMessageEndpoint, ReplicantSessionManager { @Override @Nonnull public ReplicantSession createSession( @Nonnull final Session webSocketSession ) { final ReplicantSession session = new ReplicantSession( webSocketSession ); _lock.writeLock().lock(); try { _sessions.put( session.getId(), session ); } finally { _lock.writeLock().unlock(); } return session; } }
ReplicantSessionManagerImpl implements EntityMessageEndpoint, ReplicantSessionManager { @Override @Nonnull public ReplicantSession createSession( @Nonnull final Session webSocketSession ) { final ReplicantSession session = new ReplicantSession( webSocketSession ); _lock.writeLock().lock(); try { _sessions.put( session.getId(), session ); } finally { _lock.writeLock().unlock(); } return session; }  }
ReplicantSessionManagerImpl implements EntityMessageEndpoint, ReplicantSessionManager { @Override @Nonnull public ReplicantSession createSession( @Nonnull final Session webSocketSession ) { final ReplicantSession session = new ReplicantSession( webSocketSession ); _lock.writeLock().lock(); try { _sessions.put( session.getId(), session ); } finally { _lock.writeLock().unlock(); } return session; }  @Override boolean invalidateSession( @Nonnull final ReplicantSession session ); @Override @Nullable ReplicantSession getSession( @Nonnull final String sessionId ); @Nonnull @Override Set<String> getSessionIDs(); @Override @Nonnull ReplicantSession createSession( @Nonnull final Session webSocketSession ); @SuppressWarnings( { "WeakerAccess", "unused" } ) void pingSessions(); @SuppressWarnings( "WeakerAccess" ) void removeAllSessions(); @SuppressWarnings( "WeakerAccess" ) void removeClosedSessions(); @Override boolean saveEntityMessages( @Nullable final String sessionId,
                                     @Nullable final Integer requestId,
                                     @Nonnull final Collection<EntityMessage> messages,
                                     @Nullable final ChangeSet sessionChanges ); @Override void sendChangeMessage( @Nonnull final ReplicantSession session,
                                 @Nullable final Integer requestId,
                                 @Nullable final String etag,
                                 @Nonnull final Collection<EntityMessage> messages,
                                 @Nonnull final ChangeSet changeSet ); @Override void bulkSubscribe( @Nonnull final ReplicantSession session,
                             final int channelId,
                             @Nonnull final Collection<Integer> subChannelIds,
                             @Nullable final Object filter ); @Override void subscribe( @Nonnull final ReplicantSession session,
                         @Nonnull final ChannelAddress address,
                         @Nullable final Object filter ); @Override void unsubscribe( @Nonnull final ReplicantSession session, @Nonnull final ChannelAddress address ); @Override void bulkUnsubscribe( @Nonnull final ReplicantSession session,
                               final int channelId,
                               @Nonnull final Collection<Integer> subChannelIds ); }
ReplicantSessionManagerImpl implements EntityMessageEndpoint, ReplicantSessionManager { @Override @Nonnull public ReplicantSession createSession( @Nonnull final Session webSocketSession ) { final ReplicantSession session = new ReplicantSession( webSocketSession ); _lock.writeLock().lock(); try { _sessions.put( session.getId(), session ); } finally { _lock.writeLock().unlock(); } return session; }  @Override boolean invalidateSession( @Nonnull final ReplicantSession session ); @Override @Nullable ReplicantSession getSession( @Nonnull final String sessionId ); @Nonnull @Override Set<String> getSessionIDs(); @Override @Nonnull ReplicantSession createSession( @Nonnull final Session webSocketSession ); @SuppressWarnings( { "WeakerAccess", "unused" } ) void pingSessions(); @SuppressWarnings( "WeakerAccess" ) void removeAllSessions(); @SuppressWarnings( "WeakerAccess" ) void removeClosedSessions(); @Override boolean saveEntityMessages( @Nullable final String sessionId,
                                     @Nullable final Integer requestId,
                                     @Nonnull final Collection<EntityMessage> messages,
                                     @Nullable final ChangeSet sessionChanges ); @Override void sendChangeMessage( @Nonnull final ReplicantSession session,
                                 @Nullable final Integer requestId,
                                 @Nullable final String etag,
                                 @Nonnull final Collection<EntityMessage> messages,
                                 @Nonnull final ChangeSet changeSet ); @Override void bulkSubscribe( @Nonnull final ReplicantSession session,
                             final int channelId,
                             @Nonnull final Collection<Integer> subChannelIds,
                             @Nullable final Object filter ); @Override void subscribe( @Nonnull final ReplicantSession session,
                         @Nonnull final ChannelAddress address,
                         @Nullable final Object filter ); @Override void unsubscribe( @Nonnull final ReplicantSession session, @Nonnull final ChannelAddress address ); @Override void bulkUnsubscribe( @Nonnull final ReplicantSession session,
                               final int channelId,
                               @Nonnull final Collection<Integer> subChannelIds );  }