コード例 #1
0
  @Override
  public synchronized long subscribe(String regex, SubscriberCallback client)
      throws RemoteException {

    regex = regex.replaceAll("'", "");

    Subscription s = new Subscription(regex, client);
    subscriptions.add(s);
    return s.getId();
  }
コード例 #2
0
  @Override
  public synchronized void unsubscribe(long id) throws RemoteException {

    for (Subscription sub : subscriptions) {
      if (sub.getId() == id) {
        subscriptions.remove(sub);
        break;
      }
    }
  }
コード例 #3
0
  public synchronized void killSubscriptions() {
    System.out.println("kill subs...");
    for (Subscription sub : subscriptions) {
      try {
        System.out.println("subID: " + sub.getId() + "...");
        sub.getClient().terminate();

        System.out.println("\t...removed");
      } catch (RemoteException e) {
        System.out.println("..remove error");
        // e.printStackTrace();
      }
    }
  }