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;
}
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");
}
}
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");
}
}
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);
}
}
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);
}
Aggregations