Search in sources :

Example 86 with BrokerException

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

the class ServiceConfig method resume.

public void resume() throws MBeanException {
    try {
        if (isAdminService()) {
            throw (new BrokerException("Cannot resume admin service: " + service));
        }
        logger.log(Logger.INFO, rb.I_RESUMING_SVC, service);
        ServiceUtil.resumeService(service);
    } catch (BrokerException e) {
        handleOperationException(ServiceOperations.RESUME, e);
    }
}
Also used : BrokerException(com.sun.messaging.jmq.jmsserver.util.BrokerException)

Example 87 with BrokerException

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

the class ServiceConfig method pause.

public void pause() throws MBeanException {
    try {
        if (isAdminService()) {
            throw (new BrokerException("Cannot pause admin service: " + service));
        }
        logger.log(Logger.INFO, rb.I_PAUSING_SVC, service);
        ServiceUtil.pauseService(service);
    } catch (BrokerException e) {
        handleOperationException(ServiceOperations.PAUSE, e);
    }
}
Also used : BrokerException(com.sun.messaging.jmq.jmsserver.util.BrokerException)

Example 88 with BrokerException

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

the class ServiceConfig method updateService.

private void updateService(int port, int min, int max) throws IOException, PropertyUpdateException, BrokerException {
    ServiceManager sm = Globals.getServiceManager();
    Service svc = sm.getService(getName());
    IMQService stsvc;
    if (svc == null) {
        throw new BrokerException(rb.getString(rb.X_NO_SUCH_SERVICE, getName()));
    }
    if (!(svc instanceof IMQService)) {
        throw new BrokerException("Internal Error: can updated non-standard Service");
    }
    stsvc = (IMQService) svc;
    stsvc.updateService(port, min, max);
}
Also used : BrokerException(com.sun.messaging.jmq.jmsserver.util.BrokerException) ServiceManager(com.sun.messaging.jmq.jmsserver.service.ServiceManager) IMQService(com.sun.messaging.jmq.jmsserver.service.imq.IMQService) Service(com.sun.messaging.jmq.jmsserver.service.Service) IMQService(com.sun.messaging.jmq.jmsserver.service.imq.IMQService)

Example 89 with BrokerException

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

the class DestinationUtil method getMessageFromException.

/**
 * Get a message from an Exception. This basically checks if the exception is a BrokerException and properly formats the
 * linked exceptions message. The string returned does NOT include the exception name.
 */
public static String getMessageFromException(Exception e) {
    String m = e.getMessage();
    if (e instanceof BrokerException) {
        Throwable root_ex = ((BrokerException) e).getCause();
        if (root_ex == null) {
            // no root cause
            return m;
        }
        String lm = root_ex.getMessage();
        if (lm != null) {
            m = m + "\n" + lm;
        }
    }
    return m;
}
Also used : BrokerException(com.sun.messaging.jmq.jmsserver.util.BrokerException) SizeString(com.sun.messaging.jmq.util.SizeString)

Example 90 with BrokerException

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

the class DestinationUtil method compactAllDestinations.

public static void compactAllDestinations() throws BrokerException {
    Iterator[] itrs = Globals.getDestinationList().getAllDestinations(null);
    // PART
    Iterator itr = itrs[0];
    boolean docompact = true;
    String errMsg = null;
    BrokerResources rb = Globals.getBrokerResources();
    while (itr.hasNext()) {
        // make sure all are paused
        Destination d = (Destination) itr.next();
        /*
             * Skip internal, admin, or temp destinations. Skipping temp destinations may need to be revisited.
             */
        if (d.isInternal() || d.isAdmin() || d.isTemporary()) {
            continue;
        }
        if (!d.isPaused()) {
            docompact = false;
            String msg = rb.getString(rb.E_SOME_DESTINATIONS_NOT_PAUSED);
            errMsg = rb.getString(rb.X_COMPACT_DSTS_EXCEPTION, msg);
            throw (new BrokerException(errMsg));
        }
    }
    if (docompact) {
        itrs = Globals.getDestinationList().getAllDestinations(null);
        itr = itrs[0];
        while (itr.hasNext()) {
            Destination d = (Destination) itr.next();
            /*
                 * Skip internal, admin, or temp destinations. Skipping temp destinations may need to be revisited.
                 */
            if (d.isInternal() || d.isAdmin() || d.isTemporary()) {
                continue;
            }
            d.compact();
        }
    }
}
Also used : Destination(com.sun.messaging.jmq.jmsserver.core.Destination) BrokerException(com.sun.messaging.jmq.jmsserver.util.BrokerException) Iterator(java.util.Iterator) SizeString(com.sun.messaging.jmq.util.SizeString) BrokerResources(com.sun.messaging.jmq.jmsserver.resources.BrokerResources)

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