示例#1
0
  public void leave(RoomParticipant user) {

    checkClosed();

    log.debug("PARTICIPANT {}: Leaving room {}", user.getName(), this.name);
    this.removeParticipant(user.getName());
    user.close();
  }
示例#2
0
  @Override
  public void close() {

    if (!closed) {

      executor.shutdown();

      for (final RoomParticipant user : participants.values()) {
        user.close();
      }

      participants.clear();

      if (pipeline != null) {
        pipeline.release(
            new Continuation<Void>() {

              @Override
              public void onSuccess(Void result) throws Exception {
                log.trace("ROOM {}: Released Pipeline", Room.this.name);
              }

              @Override
              public void onError(Throwable cause) throws Exception {
                log.warn("PARTICIPANT " + Room.this.name + ": Could not release Pipeline", cause);
              }
            });
      }

      log.debug("Room {} closed", this.name);

      this.closed = true;
    } else {
      log.warn("Closing a yet closed room {}", this.name);
    }
  }