コード例 #1
0
ファイル: InVMAcceptor.java プロジェクト: hellojvm/hornetq
  public synchronized void stop() {
    if (!started) {
      return;
    }

    if (!paused) {
      InVMRegistry.instance.unregisterAcceptor(id);
    }

    for (Connection connection : connections.values()) {
      listener.connectionDestroyed(connection.getID());
    }

    connections.clear();

    if (notificationService != null) {
      TypedProperties props = new TypedProperties();
      props.putSimpleStringProperty(
          new SimpleString("factory"), new SimpleString(InVMAcceptorFactory.class.getName()));
      props.putIntProperty(new SimpleString("id"), id);
      Notification notification = new Notification(null, NotificationType.ACCEPTOR_STOPPED, props);
      try {
        notificationService.sendNotification(notification);
      } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }

    started = false;

    paused = false;
  }
コード例 #2
0
ファイル: InVMAcceptor.java プロジェクト: hellojvm/hornetq
  public synchronized void start() throws Exception {
    if (started) {
      return;
    }

    InVMRegistry.instance.registerAcceptor(id, this);

    if (notificationService != null) {
      TypedProperties props = new TypedProperties();
      props.putSimpleStringProperty(
          new SimpleString("factory"), new SimpleString(InVMAcceptorFactory.class.getName()));
      props.putIntProperty(new SimpleString("id"), id);
      Notification notification = new Notification(null, NotificationType.ACCEPTOR_STARTED, props);
      notificationService.sendNotification(notification);
    }

    started = true;

    paused = false;
  }