use of com.sun.messaging.jmq.jmsserver.core.DestinationUID in project openmq by eclipse-ee4j.
the class ProducerManagerMonitor method getNumWildcardProducers.
public Integer getNumWildcardProducers(String wildcard) throws MBeanException {
int numWildcardProducers = Producer.getNumWildcardProducers();
if (numWildcardProducers <= 0) {
return (Integer.valueOf(0));
}
Iterator producers = Producer.getWildcardProducers();
if (producers == null) {
return (Integer.valueOf(0));
}
int count = 0;
while (producers.hasNext()) {
ProducerUID pid = (ProducerUID) producers.next();
Producer oneProd = (Producer) Producer.getProducer(pid);
/*
* If wildcard param is not null, check for matches If it is null, return total count of wildcards
*/
if (wildcard != null) {
DestinationUID id = oneProd.getDestinationUID();
if (id.getName().equals(wildcard)) {
count++;
}
} else {
count++;
}
}
return (Integer.valueOf(count));
}
use of com.sun.messaging.jmq.jmsserver.core.DestinationUID 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.DestinationUID in project openmq by eclipse-ee4j.
the class ProducerUtil method getDestinationNames.
private static String[] getDestinationNames(ProducerUID pid) {
Producer p = (Producer) Producer.getProducer(pid);
String[] ret = null;
if (p == null) {
return (null);
}
ArrayList<String> al = new ArrayList<>();
Set dests = p.getDestinations();
Iterator itr = dests.iterator();
while (itr.hasNext()) {
DestinationUID duid = (DestinationUID) itr.next();
al.add(duid.getName());
}
if (al.size() > 0) {
ret = new String[al.size()];
ret = al.toArray(ret);
}
return (ret);
}
use of com.sun.messaging.jmq.jmsserver.core.DestinationUID in project openmq by eclipse-ee4j.
the class TransactionLogReplayer method replaySentMessage.
private void replaySentMessage(TransactionWorkMessage workMessage, Set dstLoadedSet) throws IOException, BrokerException {
// Reconstruct the message
Packet pkt = workMessage.getMessage();
SysMessageID mid = pkt.getSysMessageID();
if (Store.getDEBUG()) {
String msg = getPrefix() + " replaying sent message: " + workMessage + " dest= " + pkt.getDestination();
logger.log(Logger.INFO, msg);
}
// Make sure destination exists; auto-create if necessary
// TODO
// recreating destinations may cause a bug if a destination had been
// deleted by a command after the message was logged.
// It will now reappear - (as an auto destination?)
String dname = pkt.getDestination();
int dtype = (pkt.getIsQueue() ? DestType.DEST_TYPE_QUEUE : DestType.DEST_TYPE_TOPIC);
List[] dss = DestinationList.findMatchingIDs(msgStore.parent, DestinationUID.getUID(dname, dtype));
List dlist = dss[0];
DestinationUID did = null;
Iterator itr = dlist.iterator();
while (itr.hasNext()) {
did = (DestinationUID) itr.next();
Destination[] ds = DestinationList.getDestination(msgStore.parent, did, dtype, true, true);
Destination dst = ds[0];
did = dst.getDestinationUID();
// Load all msgs in order to verify if any msgs are missing
if (!dstLoadedSet.contains(dst)) {
dst.load();
// Keep track of what has been loaded
dstLoadedSet.add(dst);
}
// Check to see if the msg is in the store
boolean exists = msgStore.containsMessage(did, mid);
if (exists) {
if (Store.getDEBUG()) {
String msg = getPrefix() + " stored message exists " + mid;
logger.log(Logger.INFO, msg);
}
// check if stored interests are the same as logged interests
HashMap storedInterests = msgStore.getInterestStates(did, mid);
boolean matched = compareStoredConsumers(mid, workMessage.getStoredInterests(), storedInterests);
if (!matched) {
logger.log(Logger.FORCE, BrokerResources.I_REPLACE_MSG_TXNLOG, mid);
dst.removeMessage(mid, RemoveReason.REMOVED_OTHER);
if (msgStore.containsMessage(did, mid)) {
msgStore.removeMessage(did, mid, false);
}
rerouteMessage(pkt, mid, dst);
}
} else {
if (Store.getDEBUG()) {
String msg = getPrefix() + " stored message does not exist " + mid;
logger.log(Logger.INFO, msg);
}
rerouteMessage(pkt, mid, dst);
}
}
// while
}
use of com.sun.messaging.jmq.jmsserver.core.DestinationUID in project openmq by eclipse-ee4j.
the class TransactionLogReplayer method replayMessageRemoval.
public void replayMessageRemoval(MsgRemovalEvent event, Set dstLoadedSet) throws IOException, BrokerException {
DestinationUID did = event.destUID;
SysMessageID mid = event.sysMessageID;
// Make sure dst exists; autocreate if possible
Destination[] ds = Globals.getDestinationList().getDestination(msgStore.parent, did.getName(), did.isQueue() ? DestType.DEST_TYPE_QUEUE : DestType.DEST_TYPE_TOPIC, true, true);
Destination dst = ds[0];
// Load all msgs inorder to update consumer states
if (!dstLoadedSet.contains(dst)) {
dst.load();
// Keep track of what has been loaded
dstLoadedSet.add(dst);
}
logger.log(Logger.FORCE, Globals.getBrokerResources().getKString(BrokerResources.I_RM_MSG_ON_REPLAY_MSG_REMOVAL, mid, dst));
dst.removeMessage(mid, RemoveReason.REMOVED_OTHER);
if (msgStore.containsMessage(did, mid)) {
msgStore.removeMessage(did, mid, false);
}
}
Aggregations