Package org.activemq.broker

Examples of org.activemq.broker.BrokerClient


    /**
     * @param channel - client to add
     */
    public void addClient(TransportChannel channel) {
        try {
            BrokerClient client = new BrokerClientImpl();
            client.initialize(this, channel);
            if (log.isDebugEnabled()) {
                log.debug("Starting new client: " + client);
            }
            channel.setServerSide(true);
            channel.start();
View Full Code Here


    /**
     * @param channel - client to remove
     */
    public void removeClient(TransportChannel channel) {
        BrokerClient client = (BrokerClient) clients.remove(channel);
        if (client != null) {
            if (log.isDebugEnabled()) {
                log.debug("Client leaving client: " + client);
            }

            // we may have already been closed, if not then lets simulate a normal shutdown
            client.cleanUp();
        }
        else {
            // might have got a duplicate callback
            log.warn("No such client for channel: " + channel);
        }
View Full Code Here

            // lets close all the channels
            // note that this Map implementation does not throw concurrent modification exception
            for (Iterator iter = clientIds.values().iterator();iter.hasNext();) {
                // should remove clients from parent container?
                BrokerClient client = (BrokerClient) iter.next();
                if (client != null) {
                    try {
                        client.stop();
                    }
                    catch (JMSException e) {
                        if (firstException == null) {
                            firstException = e;
                        }
View Full Code Here

    if (clientIds.containsKey(clientId)) {
      int timeout = 5000;
      log.info("Got duplicate client with id: " + clientId + ". Giving the existing client " + timeout + " millis to prove it's alive.");

      // Assert that the existing client is alive
      BrokerClient existingClient = (BrokerClient) clientIds.get(clientId);
      JMSException ex = null;
      boolean isValid = true;
      try {
        existingClient.validateConnection(timeout);
      } catch (JMSException e) {
        isValid = false;
        ex = e;
      }
      if (isValid) {
        // The existing client is valid, so kick the new client
        log.info("Client: " + clientId + " on transport: " + existingClient.getChannel()
            + "' is alive, rejecting new client on transport: " + client.getChannel());
        throw new InvalidClientIDException("Duplicate clientId: " + info);
      } else {
        // A transport error occured or the existing client did not
        // respond in time, so kick it and let the new client connect.
        log.info("Replacing client: " + clientId + " on transport: " + existingClient.getChannel() + " ("
            + ex.getMessage() + ") with client on transport: " + client.getChannel());
       
        // @TODO: Not sure this is the proper way to close the existing client
        existingClient.cleanUp();
        existingClient.stop();
      }

    }
    getBroker().addClient(client, info);
    log.info("Adding new client: " + clientId + " on transport: " + client.getChannel());
View Full Code Here

     * @param event
     */
    public void capacityChanged(CapacityMonitorEvent event) {
        //only send to producers
        for (Iterator i = producerInfos.values().iterator(); i.hasNext();) {
            BrokerClient client = (BrokerClient) i.next();
            client.updateBrokerCapacity(event.getCapacity());
        }
    }
View Full Code Here

            consumerInfoListeners.add(l);
            //fire any existing infos to the listener
            for (Iterator i = messageConsumers.entrySet().iterator(); i.hasNext();){
                Map.Entry entry = (Map.Entry)i.next();
                ConsumerInfo info = (ConsumerInfo) entry.getKey();
                BrokerClient client = (BrokerClient) entry.getValue();
                l.onConsumerInfo(client, info);
            }
        }
    }
View Full Code Here

            // lets close all the channels
            // note that this Map implementation does not throw concurrent modification exception
            for (Iterator iter = clientIds.values().iterator();iter.hasNext();) {
                // should remove clients from parent container?
                BrokerClient client = (BrokerClient) iter.next();
                if (client != null) {
                    try {
                        client.stop();
                    }
                    catch (JMSException e) {
                        if (firstException == null) {
                            firstException = e;
                        }
View Full Code Here

    if (clientIds.containsKey(clientId)) {
      int timeout = 5000;
      log.info("Got duplicate client with id: " + clientId + ". Giving the existing client " + timeout + " millis to prove it's alive.");

      // Assert that the existing client is alive
      BrokerClient existingClient = (BrokerClient) clientIds.get(clientId);
      JMSException ex = null;
      boolean isValid = true;
      try {
        existingClient.validateConnection(timeout);
      } catch (JMSException e) {
        isValid = false;
        ex = e;
      }
      if (isValid) {
        // The existing client is valid, so kick the new client
        log.info("Client: " + clientId + " on transport: " + existingClient.getChannel()
            + "' is alive, rejecting new client on transport: " + client.getChannel());
        throw new InvalidClientIDException("Duplicate clientId: " + info);
      } else {
        // A transport error occured or the existing client did not
        // respond in time, so kick it and let the new client connect.
        log.info("Replacing client: " + clientId + " on transport: " + existingClient.getChannel() + " ("
            + ex.getMessage() + ") with client on transport: " + client.getChannel());
       
        // @TODO: Not sure this is the proper way to close the existing client
        existingClient.cleanUp();
        existingClient.stop();
      }

    }
    getBroker().addClient(client, info);
    log.info("Adding new client: " + clientId + " on transport: " + client.getChannel());
View Full Code Here

     * @param event
     */
    public void capacityChanged(CapacityMonitorEvent event) {
        //only send to producers
        for (Iterator i = producerInfos.values().iterator(); i.hasNext();) {
            BrokerClient client = (BrokerClient) i.next();
            client.updateBrokerCapacity(event.getCapacity());
        }
    }
View Full Code Here

    /**
     * Returns whether or not the consumer can receive the given message
     */
    protected boolean isAuthorizedForMessage(ActiveMQMessage message) {
        // TODO we could maybe provide direct access to the security adapter
        BrokerClient client = getActiveClient();
        if (client != null) {
            BrokerConnector connector = client.getBrokerConnector();
            if (connector != null) {
                BrokerContainer container = connector.getBrokerContainer();
                if (container != null) {
                    Broker broker = container.getBroker();
                    if (broker != null) {
View Full Code Here

TOP

Related Classes of org.activemq.broker.BrokerClient

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.