コード例 #1
0
 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;
 }
コード例 #2
0
 @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;
 }
コード例 #3
0
 @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));
 }
コード例 #4
0
  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);
  }
コード例 #5
0
 public ConnectionIDFactoryImpl(ClientStatePersistor clientStateStore) {
   this.clientStateStore = clientStateStore;
   this.connectionIDSequence = clientStateStore.getConnectionIDSequence();
   this.uid = connectionIDSequence.getUID();
 }