use of com.sun.messaging.jmq.jmsserver.core.ConsumerUID in project openmq by eclipse-ee4j.
the class ProtocolConsumerUIDIterator method next.
/**
* Caller must catch RuntimeException and getCause
*/
@Override
public Object next() throws RuntimeException {
try {
ConsumerUID cid = ClusterConsumerInfo.readConsumerUID(dis);
if (from != null) {
cid.setBrokerAddress(from);
}
count_read++;
return cid;
} catch (IOException e) {
count_read = -1;
throw new RuntimeException(e);
}
}
use of com.sun.messaging.jmq.jmsserver.core.ConsumerUID in project openmq by eclipse-ee4j.
the class ConnectionMonitor method getConsumerIDs.
public String[] getConsumerIDs() throws MBeanException {
List consumerIDs = ConnectionUtil.getConsumerIDs(id);
String[] ids;
if ((consumerIDs == null) || (consumerIDs.size() == 0)) {
return (null);
}
ids = new String[consumerIDs.size()];
Iterator iter = consumerIDs.iterator();
int i = 0;
while (iter.hasNext()) {
ConsumerUID cid = (ConsumerUID) iter.next();
long conID = cid.longValue();
String id;
try {
id = Long.toString(conID);
ids[i] = id;
} catch (Exception ex) {
handleOperationException(ConnectionOperations.GET_CONSUMER_IDS, ex);
}
i++;
}
return (ids);
}
use of com.sun.messaging.jmq.jmsserver.core.ConsumerUID in project openmq by eclipse-ee4j.
the class ConsumerManagerConfig method purge.
public void purge(String consumerID) throws MBeanException {
ConsumerUID cid = null;
try {
cid = new ConsumerUID(Long.parseLong(consumerID));
} catch (Exception e) {
/*
* XXX - should send specific 'cannot parse consumerID' exception
*/
handleOperationException(ConsumerOperations.PURGE, e);
}
Consumer con = Consumer.getConsumer(cid);
if (!con.isDurableSubscriber()) {
logger.log(Logger.INFO, "Purge not supported for non durable subscribers.");
return;
}
if (con instanceof Subscription) {
Subscription sub = (Subscription) con;
try {
sub.purge();
} catch (Exception e) {
handleOperationException(ConsumerOperations.PURGE, e);
}
}
}
use of com.sun.messaging.jmq.jmsserver.core.ConsumerUID in project openmq by eclipse-ee4j.
the class ConsumerManagerMonitor method getNumWildcardConsumers.
public Integer getNumWildcardConsumers(String wildcard) throws MBeanException {
int numWildcardConsumers = Consumer.getNumWildcardConsumers();
if (numWildcardConsumers <= 0) {
return (Integer.valueOf(0));
}
Iterator consumers = Consumer.getWildcardConsumers();
if (consumers == null) {
return (Integer.valueOf(0));
}
int count = 0;
while (consumers.hasNext()) {
ConsumerUID cid = (ConsumerUID) consumers.next();
Consumer oneCon = Consumer.getConsumer(cid);
/*
* If wildcard param is not null, check for matches If it is null, return total count of wildcards
*/
if (wildcard != null) {
DestinationUID id = oneCon.getDestinationUID();
if (id.getName().equals(wildcard)) {
count++;
}
} else {
count++;
}
}
return (Integer.valueOf(count));
}
use of com.sun.messaging.jmq.jmsserver.core.ConsumerUID in project openmq by eclipse-ee4j.
the class ConsumerUtil method getAllConsumersNoChildren.
public static HashMap getAllConsumersNoChildren() {
Iterator it = Consumer.getAllConsumers();
HashMap<ConsumerUID, Consumer> consumersNoChildren = new HashMap<>();
while (it.hasNext()) {
Consumer oneCon = (Consumer) it.next();
ConsumerUID cid = oneCon.getConsumerUID();
if (oneCon.getSubscription() == null) {
consumersNoChildren.put(cid, oneCon);
}
}
return (consumersNoChildren);
}
Aggregations