Пример #1
0
  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
    public void connectionCreated(
        final HornetQComponent component, final Connection connection, final String protocol) {
      if (connections.putIfAbsent((String) connection.getID(), connection) != null) {
        throw HornetQMessageBundle.BUNDLE.connectionExists(connection.getID());
      }

      listener.connectionCreated(component, connection, protocol);
    }
Пример #3
0
  public void disconnect(final String connectionID) {
    if (!started) {
      return;
    }

    Connection conn = connections.get(connectionID);

    if (conn != null) {
      conn.close();
    }
  }
Пример #4
0
  public void connectionCreated(
      final HornetQComponent component, final Connection connection, final String protocol) {
    if (server == null) {
      throw new IllegalStateException(
          "Unable to create connection, server hasn't finished starting up");
    }

    ProtocolManager pmgr = this.getProtocolManager(protocol.toString());

    if (pmgr == null) {
      throw HornetQMessageBundle.BUNDLE.unknownProtocol(protocol);
    }

    ConnectionEntry entry = pmgr.createConnectionEntry((Acceptor) component, connection);

    if (isTrace) {
      HornetQServerLogger.LOGGER.trace("Connection created " + connection);
    }

    connections.put(connection.getID(), entry);
  }