Search in sources :

Example 21 with BrokerException

use of com.sun.messaging.jmq.jmsserver.util.BrokerException in project openmq by eclipse-ee4j.

the class Agent method getDefaultJMXUrlPathBase.

public String getDefaultJMXUrlPathBase() throws BrokerException {
    MQAddress addr = Globals.getMQAddress();
    String rmiRegHostName, brokerHostName, ret = null;
    int brokerPort, rmiRegistryPort;
    if (addr == null) {
        return (null);
    }
    /*
         * These other methods work too. Would be good if we could obtain a fully qualified hostname i.e. with domain.
         * brokerHostName = Globals.getBrokerHostName(); brokerHostName = Globals.getBrokerInetAddress().getCanonicalHostName();
         */
    brokerHostName = addr.getHostName();
    rmiRegHostName = Globals.getJMXHostname();
    brokerPort = addr.getPort();
    rmiRegistryPort = getRmiRegistryPort();
    /*
         * rmiRegHostName can be null if imq.jmx.hostname or imq.hostname is not set.
         */
    if (rmiRegHostName == null) {
        rmiRegHostName = brokerHostName;
    } else {
        try {
            rmiRegHostName = MQAddress.getMQAddress(rmiRegHostName, rmiRegistryPort).getHostName();
        } catch (MalformedURLException e) {
            throw new BrokerException(e.toString(), e);
        }
    }
    /*
         * The default urlpath base is: /jndi/rmi://<brokerhost>:<rmiport>/<brokerhost>/<brokerport>/ e.g
         * /jndi/rmi://myhost:1099/myhost/7676/
         */
    ret = "/jndi/rmi://" + rmiRegHostName + ":" + Integer.toString(rmiRegistryPort) + "/" + brokerHostName + "/" + Integer.toString(brokerPort) + "/";
    return (ret);
}
Also used : MalformedURLException(java.net.MalformedURLException) BrokerException(com.sun.messaging.jmq.jmsserver.util.BrokerException) MQAddress(com.sun.messaging.jmq.io.MQAddress)

Example 22 with BrokerException

use of com.sun.messaging.jmq.jmsserver.util.BrokerException in project openmq by eclipse-ee4j.

the class ConnectorServerManager method initConfiguredConnectorServers.

/*
     * Initialize connectors table with list specified by properties: imq.jmx.connector.list all connectors
     * imq.jmx.connector.activelist connectors to be made active
     */
public void initConfiguredConnectorServers() throws BrokerException {
    List connectorServers = getAllJMXConnectorNames();
    Set s = connectors.keySet();
    /*
         * Empty out existing connectors in hashtable
         */
    Iterator itr = s.iterator();
    while (itr.hasNext()) {
        String name = (String) itr.next();
        try {
            /*
                 * stop/remove connector
                 */
            remove(name);
        } catch (Exception e) {
            logger.log(Logger.WARNING, rb.getString(rb.W_JMX_REMOVE_CONNECTOR_EXCEPTION, name), e);
        }
    }
    for (int i = 0; i < connectorServers.size(); i++) {
        String name = (String) connectorServers.get(i);
        add(name, connectorIsConfiguredActive(name));
    }
}
Also used : Set(java.util.Set) Iterator(java.util.Iterator) List(java.util.List) IOException(java.io.IOException) BrokerException(com.sun.messaging.jmq.jmsserver.util.BrokerException)

Example 23 with BrokerException

use of com.sun.messaging.jmq.jmsserver.util.BrokerException in project openmq by eclipse-ee4j.

the class ConnectorServerManager method start.

/**
 * Start one connector server
 */
public void start(String name) throws IOException, BrokerException {
    ConnectorServerInfo csInfo;
    csInfo = (ConnectorServerInfo) connectors.get(name);
    if (csInfo == null) {
        throw new BrokerException(rb.getString(rb.W_JMX_START_CONNECTOR_NON_EXISTANT, name));
    }
    try {
        csInfo.start();
        HashMap map = new HashMap();
        map.put("url", csInfo.getJMXServiceURL().toString());
        Globals.getPortMapper().addService(name, csInfo.getProtocol(), "JMX", csInfo.getPort(), map);
        logger.log(Logger.INFO, rb.getKString(rb.I_JMX_CONNECTOR_STARTED, name, csInfo.getJMXServiceURL()));
    } catch (IOException e) {
        logger.logStack(Logger.WARNING, rb.getKString(rb.W_JMX_CONNECTOR_START_EXCEPTION, name), e);
        throw (e);
    }
}
Also used : BrokerException(com.sun.messaging.jmq.jmsserver.util.BrokerException) HashMap(java.util.HashMap) IOException(java.io.IOException)

Example 24 with BrokerException

use of com.sun.messaging.jmq.jmsserver.util.BrokerException in project openmq by eclipse-ee4j.

the class BrokerConfig method quiesce.

public void quiesce() throws MBeanException {
    BrokerStateHandler bsh = Globals.getBrokerStateHandler();
    logger.log(Logger.INFO, "Quiesce request received by MBean " + getMBeanName());
    try {
        bsh.quiesce();
    } catch (BrokerException e) {
        handleOperationException(BrokerOperations.QUIESCE, e);
    }
}
Also used : BrokerException(com.sun.messaging.jmq.jmsserver.util.BrokerException) BrokerStateHandler(com.sun.messaging.jmq.jmsserver.BrokerStateHandler)

Example 25 with BrokerException

use of com.sun.messaging.jmq.jmsserver.util.BrokerException in project openmq by eclipse-ee4j.

the class TransactionInformation method addConsumedMessage.

public synchronized void addConsumedMessage(SysMessageID sysid, ConsumerUID id, ConsumerUID sid) throws BrokerException {
    // first check if we have exceeded our maximum message count per txn
    if (consumed.size() < TransactionList.defaultConsumerMaxMsgCnt) {
        List l = (List) consumed.get(sysid);
        if (l == null) {
            l = new ArrayList();
            consumed.put(sysid, l);
        } else if (l.contains(id)) {
            throw new TransactionAckExistException(Globals.getBrokerResources().getKString(Globals.getBrokerResources().X_ACK_EXISTS_IN_TRANSACTION, "[" + sysid + ":" + id + "," + sid + "]", tid), Status.CONFLICT);
        }
        l.add(id);
        cuidToStored.put(id, sid);
    } else {
        throw new BrokerException(Globals.getBrokerResources().getKString(BrokerResources.X_TXN_CONSUMER_MAX_MESSAGE_COUNT_EXCEEDED, TransactionList.defaultConsumerMaxMsgCnt, tid), BrokerResources.X_TXN_CONSUMER_MAX_MESSAGE_COUNT_EXCEEDED, (Throwable) null, Status.RESOURCE_FULL);
    }
}
Also used : TransactionAckExistException(com.sun.messaging.jmq.jmsserver.util.TransactionAckExistException) BrokerException(com.sun.messaging.jmq.jmsserver.util.BrokerException) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

BrokerException (com.sun.messaging.jmq.jmsserver.util.BrokerException)290 IOException (java.io.IOException)72 Destination (com.sun.messaging.jmq.jmsserver.core.Destination)33 PacketReference (com.sun.messaging.jmq.jmsserver.core.PacketReference)31 SizeString (com.sun.messaging.jmq.util.SizeString)31 ConsumerUID (com.sun.messaging.jmq.jmsserver.core.ConsumerUID)29 Iterator (java.util.Iterator)26 ArrayList (java.util.ArrayList)25 SelectorFormatException (com.sun.messaging.jmq.util.selector.SelectorFormatException)24 DestinationUID (com.sun.messaging.jmq.jmsserver.core.DestinationUID)23 HashMap (java.util.HashMap)22 SysMessageID (com.sun.messaging.jmq.io.SysMessageID)21 TransactionList (com.sun.messaging.jmq.jmsserver.data.TransactionList)21 LoadException (com.sun.messaging.jmq.jmsserver.persist.api.LoadException)21 Consumer (com.sun.messaging.jmq.jmsserver.core.Consumer)18 List (java.util.List)18 Packet (com.sun.messaging.jmq.io.Packet)16 BrokerAddress (com.sun.messaging.jmq.jmsserver.core.BrokerAddress)16 TransactionUID (com.sun.messaging.jmq.jmsserver.data.TransactionUID)16 ConsumerAlreadyAddedException (com.sun.messaging.jmq.jmsserver.util.ConsumerAlreadyAddedException)15