Search in sources :

Example 21 with Agent

use of com.sun.messaging.jmq.jmsserver.management.agent.Agent in project openmq by eclipse-ee4j.

the class BrokerStateHandler method initiateShutdown.

public void initiateShutdown(String requestedBy, long time, boolean triggerFailover, int exitCode, boolean threadOff, boolean exit, boolean cleanupJMX) {
    synchronized (this) {
        if (shutdownStarted) {
            if (targetShutdownTime > 0) {
                if (time > 0) {
                    targetShutdownTime = System.currentTimeMillis() + time;
                } else {
                    targetShutdownTime = 0;
                }
                this.notifyAll();
            }
            return;
        }
        shutdownStarted = true;
    }
    Agent agent = Globals.getAgent();
    if (agent != null) {
        agent.notifyShutdownStart();
    }
    if (time > 0) {
        targetShutdownTime = System.currentTimeMillis() + time;
    } else {
        targetShutdownTime = 0;
    }
    ShutdownRunnable runner = new ShutdownRunnable(requestedBy, triggerFailover, exitCode, cleanupJMX);
    if (threadOff) {
        Thread thr = new MQThread(runner, "shutdown thread");
        thr.setDaemon(false);
        thr.start();
    } else {
        // run in current thread
        int shutdown = runner.shutdown();
        if (exit) {
            System.exit(shutdown);
        }
    }
}
Also used : Agent(com.sun.messaging.jmq.jmsserver.management.agent.Agent) MQThread(com.sun.messaging.jmq.util.MQThread) MQThread(com.sun.messaging.jmq.util.MQThread)

Example 22 with Agent

use of com.sun.messaging.jmq.jmsserver.management.agent.Agent in project openmq by eclipse-ee4j.

the class Destination method resumeDestination.

public void resumeDestination() {
    assert (state > DestState.RUNNING && state <= DestState.PAUSED);
    int oldstate = state;
    state = DestState.RUNNING;
    if (oldstate == DestState.PRODUCERS_PAUSED || oldstate == DestState.PAUSED) {
        producerFlow.updateAllProducers(DEST_RESUME, "Destination is resumed");
    }
    if (oldstate == DestState.CONSUMERS_PAUSED || oldstate == DestState.PAUSED) {
        synchronized (consumers) {
            Iterator itr = consumers.values().iterator();
            while (itr.hasNext()) {
                Consumer c = (Consumer) itr.next();
                c.resume("Destination.RESUME");
            }
        }
    }
    Agent agent = Globals.getAgent();
    if (agent != null) {
        agent.notifyDestinationResume(this);
    }
}
Also used : Agent(com.sun.messaging.jmq.jmsserver.management.agent.Agent)

Example 23 with Agent

use of com.sun.messaging.jmq.jmsserver.management.agent.Agent in project openmq by eclipse-ee4j.

the class Destination method compact.

/**
 * Compact the message file.
 */
public void compact() throws BrokerException {
    if (!(pstore instanceof DiskFileStore)) {
        throw new BrokerException("XXXI18N - operation not supported");
    }
    ((DiskFileStore) pstore).compactDestination(this);
    Agent agent = Globals.getAgent();
    if (agent != null) {
        agent.notifyDestinationCompact(this);
    }
}
Also used : Agent(com.sun.messaging.jmq.jmsserver.management.agent.Agent) BrokerException(com.sun.messaging.jmq.jmsserver.util.BrokerException) DiskFileStore(com.sun.messaging.jmq.jmsserver.persist.api.DiskFileStore)

Aggregations

Agent (com.sun.messaging.jmq.jmsserver.management.agent.Agent)23 BrokerException (com.sun.messaging.jmq.jmsserver.util.BrokerException)6 SysMessageID (com.sun.messaging.jmq.io.SysMessageID)3 DestinationList (com.sun.messaging.jmq.jmsserver.core.DestinationList)3 TransactionList (com.sun.messaging.jmq.jmsserver.data.TransactionList)3 PartitionedStore (com.sun.messaging.jmq.jmsserver.persist.api.PartitionedStore)3 CacheHashMap (com.sun.messaging.jmq.util.CacheHashMap)3 SelectorFormatException (com.sun.messaging.jmq.util.selector.SelectorFormatException)3 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 List (java.util.List)3 ConsumerUID (com.sun.messaging.jmq.jmsserver.core.ConsumerUID)2 Destination (com.sun.messaging.jmq.jmsserver.core.Destination)2 PacketReference (com.sun.messaging.jmq.jmsserver.core.PacketReference)2 BaseTransaction (com.sun.messaging.jmq.jmsserver.data.BaseTransaction)2 LocalTransaction (com.sun.messaging.jmq.jmsserver.data.LocalTransaction)2 AckEntryNotFoundException (com.sun.messaging.jmq.jmsserver.util.AckEntryNotFoundException)2 BrokerDownException (com.sun.messaging.jmq.jmsserver.util.BrokerDownException)2 MaxConsecutiveRollbackException (com.sun.messaging.jmq.jmsserver.util.MaxConsecutiveRollbackException)2