Search in sources :

Example 1 with ConsumerSpi

use of com.sun.messaging.jmq.jmsserver.plugin.spi.ConsumerSpi in project openmq by eclipse-ee4j.

the class IMQConnection method getConsumersIDs.

public List getConsumersIDs() {
    ArrayList cons = new ArrayList();
    Iterator itr = sessions.values().iterator();
    while (itr.hasNext()) {
        Session s = (Session) itr.next();
        Iterator citr = s.getConsumers();
        while (citr.hasNext()) {
            ConsumerSpi c = (ConsumerSpi) citr.next();
            cons.add(c.getConsumerUID());
        }
    }
    return cons;
}
Also used : ConsumerSpi(com.sun.messaging.jmq.jmsserver.plugin.spi.ConsumerSpi) Session(com.sun.messaging.jmq.jmsserver.core.Session)

Example 2 with ConsumerSpi

use of com.sun.messaging.jmq.jmsserver.plugin.spi.ConsumerSpi in project openmq by eclipse-ee4j.

the class Session method dump.

public void dump(String prefix) {
    if (prefix == null) {
        prefix = "";
    }
    logger.log(Logger.INFO, prefix + " Session " + uid);
    logger.log(Logger.INFO, prefix + "---------------------------");
    logger.log(Logger.INFO, prefix + "busyConsumers (size) " + busyConsumers.size());
    logger.log(Logger.INFO, prefix + "busyConsumers (list) " + busyConsumers);
    logger.log(Logger.INFO, prefix + "consumers (size) " + consumers.size());
    logger.log(Logger.INFO, prefix + "consumers (list) " + consumers);
    logger.log(Logger.INFO, prefix + "---------------------------");
    Iterator itr = consumers.values().iterator();
    while (itr.hasNext()) {
        ((ConsumerSpi) itr.next()).dump(prefix + "\t");
    }
}
Also used : Iterator(java.util.Iterator) ConsumerSpi(com.sun.messaging.jmq.jmsserver.plugin.spi.ConsumerSpi)

Example 3 with ConsumerSpi

use of com.sun.messaging.jmq.jmsserver.plugin.spi.ConsumerSpi in project openmq by eclipse-ee4j.

the class Session method debug.

public void debug(String prefix) {
    if (prefix == null) {
        prefix = "";
    }
    logger.log(Logger.INFO, prefix + "Session " + uid);
    logger.log(Logger.INFO, "Paused " + paused);
    logger.log(Logger.INFO, "pausecnt " + pausecnt);
    logger.log(Logger.INFO, "busy " + busy);
    logger.log(Logger.INFO, "ConsumerCnt " + consumers.size());
    logger.log(Logger.INFO, "BusyConsumerCnt " + consumers.size());
    Iterator itr = consumers.values().iterator();
    while (itr.hasNext()) {
        ConsumerSpi c = (ConsumerSpi) itr.next();
        c.debug("\t");
    }
}
Also used : Iterator(java.util.Iterator) ConsumerSpi(com.sun.messaging.jmq.jmsserver.plugin.spi.ConsumerSpi)

Example 4 with ConsumerSpi

use of com.sun.messaging.jmq.jmsserver.plugin.spi.ConsumerSpi in project openmq by eclipse-ee4j.

the class Session method fillNextPacket.

public boolean fillNextPacket(Packet p, ConsumerUID cid) {
    if (paused) {
        return false;
    }
    ConsumerSpi consumer = (ConsumerSpi) consumers.get(cid);
    Object ref = null;
    synchronized (sessionLock) {
        ref = consumer.getAndFillNextPacket(p);
        if (ref == null) {
            return false;
        }
        return ssop.onMessageDelivery(consumer, ref);
    }
}
Also used : ConsumerSpi(com.sun.messaging.jmq.jmsserver.plugin.spi.ConsumerSpi)

Example 5 with ConsumerSpi

use of com.sun.messaging.jmq.jmsserver.plugin.spi.ConsumerSpi in project openmq by eclipse-ee4j.

the class Session method close.

private void close() {
    synchronized (this) {
        if (!valid) {
            return;
        }
        valid = false;
    }
    if (DEBUG) {
        logger.log(Logger.INFO, "Close Session " + uid);
    }
    Connection conn = Globals.getConnectionManager().getConnection(getConnectionUID());
    boolean old = false;
    if (conn != null && conn.getClientProtocolVersion() < Connection.RAPTOR_PROTOCOL) {
        old = true;
    }
    Iterator itr = null;
    synchronized (this) {
        itr = new HashSet(consumers.values()).iterator();
    }
    while (itr.hasNext()) {
        ConsumerSpi c = (ConsumerSpi) itr.next();
        itr.remove();
        detatchConsumer(c, null, false, old, false);
    }
    ssop.close(conn);
    // Clear up old session to consumer match
    synchronized (consumerToSession) {
        Iterator citr = consumerToSession.values().iterator();
        while (citr.hasNext()) {
            SessionUID suid = (SessionUID) citr.next();
            if (suid.equals(uid)) {
                citr.remove();
            }
        }
    }
    allSessions.remove(uid);
}
Also used : Connection(com.sun.messaging.jmq.jmsserver.service.Connection) Iterator(java.util.Iterator) ConsumerSpi(com.sun.messaging.jmq.jmsserver.plugin.spi.ConsumerSpi) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet)

Aggregations

ConsumerSpi (com.sun.messaging.jmq.jmsserver.plugin.spi.ConsumerSpi)10 Iterator (java.util.Iterator)5 Session (com.sun.messaging.jmq.jmsserver.core.Session)3 ConsumerUID (com.sun.messaging.jmq.jmsserver.core.ConsumerUID)2 BrokerException (com.sun.messaging.jmq.jmsserver.util.BrokerException)2 FaultInjection (com.sun.messaging.jmq.jmsserver.FaultInjection)1 Consumer (com.sun.messaging.jmq.jmsserver.core.Consumer)1 Destination (com.sun.messaging.jmq.jmsserver.core.Destination)1 DestinationUID (com.sun.messaging.jmq.jmsserver.core.DestinationUID)1 Producer (com.sun.messaging.jmq.jmsserver.core.Producer)1 ProducerUID (com.sun.messaging.jmq.jmsserver.core.ProducerUID)1 SessionUID (com.sun.messaging.jmq.jmsserver.core.SessionUID)1 Connection (com.sun.messaging.jmq.jmsserver.service.Connection)1 ConnectionUID (com.sun.messaging.jmq.jmsserver.service.ConnectionUID)1 Service (com.sun.messaging.jmq.jmsserver.service.Service)1 IMQConnection (com.sun.messaging.jmq.jmsserver.service.imq.IMQConnection)1 DebugPrinter (com.sun.messaging.jmq.util.DebugPrinter)1 HashSet (java.util.HashSet)1 Hashtable (java.util.Hashtable)1 LinkedHashSet (java.util.LinkedHashSet)1