@Test public void deleteCacheEntry() { final ChannelMetaData ch1 = new ChannelMetaData( 0, "C1", null, ChannelMetaData.FilterType.NONE, null, ChannelMetaData.CacheType.INTERNAL, false, true ); final ChannelMetaData[] channels = new ChannelMetaData[]{ ch1 }; final ChannelAddress address1 = new ChannelAddress( ch1.getChannelId(), null ); final TestReplicantSessionManager sm = new TestReplicantSessionManager( channels ); assertFalse( sm.deleteCacheEntry( address1 ) ); sm.setCacheKey( "X" ); sm.tryGetCacheEntry( address1 ); assertTrue( sm.deleteCacheEntry( address1 ) ); }
@SuppressWarnings( "WeakerAccess" ) protected boolean deleteCacheEntry( @Nonnull final ChannelAddress address ) { _cacheLock.writeLock().lock(); try { return null != _cache.remove( address ); } finally { _cacheLock.writeLock().unlock(); } }
ReplicantSessionManagerImpl implements EntityMessageEndpoint, ReplicantSessionManager { @SuppressWarnings( "WeakerAccess" ) protected boolean deleteCacheEntry( @Nonnull final ChannelAddress address ) { _cacheLock.writeLock().lock(); try { return null != _cache.remove( address ); } finally { _cacheLock.writeLock().unlock(); } } }
ReplicantSessionManagerImpl implements EntityMessageEndpoint, ReplicantSessionManager { @SuppressWarnings( "WeakerAccess" ) protected boolean deleteCacheEntry( @Nonnull final ChannelAddress address ) { _cacheLock.writeLock().lock(); try { return null != _cache.remove( address ); } finally { _cacheLock.writeLock().unlock(); } }  }
ReplicantSessionManagerImpl implements EntityMessageEndpoint, ReplicantSessionManager { @SuppressWarnings( "WeakerAccess" ) protected boolean deleteCacheEntry( @Nonnull final ChannelAddress address ) { _cacheLock.writeLock().lock(); try { return null != _cache.remove( address ); } finally { _cacheLock.writeLock().unlock(); } }  @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 { @SuppressWarnings( "WeakerAccess" ) protected boolean deleteCacheEntry( @Nonnull final ChannelAddress address ) { _cacheLock.writeLock().lock(); try { return null != _cache.remove( address ); } finally { _cacheLock.writeLock().unlock(); } }  @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 );  }