private ConnectionID buildConnectionId(String jvmID, long channelID, ProductID productId) { Assert.assertNotNull(uid); // Make sure we save the fact that we are giving out this id to someone in the database before // giving it out. clientStateStore.saveClientState(new ChannelID(channelID)); ConnectionID rv = new ConnectionID(jvmID, channelID, uid, null, null, productId); fireCreationEvent(rv); return rv; }
@Override public Set<ConnectionID> loadConnectionIDs() { Assert.assertNotNull(uid); Set<ConnectionID> connections = new HashSet<>(); for (final ChannelID channelID : clientStateStore.loadClientIDs()) { connections.add(new ConnectionID(ConnectionID.NULL_JVM_ID, (channelID).toLong(), uid)); } return connections; }
@Override public void channelRemoved(MessageChannel channel) { ChannelID clientID = channel.getChannelID(); try { clientStateStore.deleteClientState(clientID); } catch (ClientNotFoundException e) { throw new AssertionError(e); } fireDestroyedEvent(new ConnectionID(ConnectionID.NULL_JVM_ID, clientID.toLong(), uid)); }
private ConnectionID makeConnectionId(String clientJvmID, long channelID, ProductID productId) { Assert.assertTrue(channelID != ChannelID.NULL_ID.toLong()); // provided channelID shall not be using if (clientStateStore.containsClient(new ChannelID(channelID))) { throw new TCRuntimeException( "The connectionId " + channelID + " has been used. " + " One possible cause: restarted some mirror groups but not all."); } return buildConnectionId(clientJvmID, channelID, productId); }
public ConnectionIDFactoryImpl(ClientStatePersistor clientStateStore) { this.clientStateStore = clientStateStore; this.connectionIDSequence = clientStateStore.getConnectionIDSequence(); this.uid = connectionIDSequence.getUID(); }