Esempio n. 1
0
    public void init(String[] users, Ice.Current current) {
      List<ChatRoomListener> copy;
      final List<String> u = Arrays.asList(users);

      synchronized (this) {
        _users.clear();
        _users.addAll(u);

        // No replay event for init.
        copy = new ArrayList<ChatRoomListener>(_listeners);
      }

      for (ChatRoomListener listener : copy) {
        listener.init(u);
      }
    }
Esempio n. 2
0
  // This method is only called by the UI thread.
  public synchronized String addChatRoomListener(ChatRoomListener cb, boolean replay) {
    _listeners.add(cb);
    cb.init(_users);

    if (replay) {
      // Replay the entire state.
      for (ChatEventReplay r : _replay) {
        r.replay(cb);
      }
    }

    if (_error != null) {
      cb.error();
    }

    return _hostname;
  }