Search in sources :

Example 11 with Producer

use of com.sun.messaging.jmq.jmsserver.core.Producer in project openmq by eclipse-ee4j.

the class ProducerHandler method removeProducer.

public void removeProducer(ProducerUID pid, boolean isIndemp, IMQConnection con, String msg) throws BrokerException {
    String reason = null;
    int status = Status.OK;
    Producer p = (Producer) Producer.getProducer(pid);
    if (p == null && isIndemp) {
    // dont flag error, we already processed it
    } else if (p == null) {
        logger.log(Logger.INFO, BrokerResources.E_INTERNAL_BROKER_ERROR, "Internal error Unable to find producer " + pid + "\n\t checking if producer was removed recently " + Producer.checkProducer(pid));
        reason = "unknown producer";
        status = Status.ERROR;
        throw new BrokerException(reason, status);
    } else if (p.getConnectionUID() != con.getConnectionUID()) {
        logger.log(Logger.INFO, BrokerResources.E_INTERNAL_BROKER_ERROR, " error connection " + "removing producer it doesnt own" + "\n\tPID=" + pid + "\n\tconnectionUID of request " + con.getConnectionUID() + "\n\tconnectionUID of creator " + p.getConnectionUID() + "\n\tchecking producer state: " + Producer.checkProducer(pid));
        reason = "unknown producer";
        status = Status.ERROR;
        throw new BrokerException(reason, status);
    } else {
        con.removeProducer(pid, msg, coreLifecycle);
    }
}
Also used : BrokerException(com.sun.messaging.jmq.jmsserver.util.BrokerException) Producer(com.sun.messaging.jmq.jmsserver.core.Producer)

Example 12 with Producer

use of com.sun.messaging.jmq.jmsserver.core.Producer in project openmq by eclipse-ee4j.

the class ProducerUtil method getHost.

public static String getHost(ProducerUID pid) {
    Producer p = (Producer) Producer.getProducer(pid);
    ConnectionUID cxnId = null;
    if (p == null) {
        return (null);
    }
    cxnId = p.getConnectionUID();
    if (cxnId == null) {
        return (null);
    }
    ConnectionInfo cxnInfo = ConnectionUtil.getConnectionInfo(cxnId.longValue());
    if (cxnInfo == null) {
        return (null);
    }
    String host = null;
    if (cxnInfo.remoteIP != null) {
        host = String.valueOf(IPAddress.rawIPToString(cxnInfo.remoteIP, true, true));
    }
    return (host);
}
Also used : Producer(com.sun.messaging.jmq.jmsserver.core.Producer) ConnectionUID(com.sun.messaging.jmq.jmsserver.service.ConnectionUID) ConnectionInfo(com.sun.messaging.jmq.util.admin.ConnectionInfo)

Example 13 with Producer

use of com.sun.messaging.jmq.jmsserver.core.Producer in project openmq by eclipse-ee4j.

the class ProducerUtil method getProducerIDs.

public static String[] getProducerIDs() {
    int numProducers = Producer.getNumProducers();
    String[] ids;
    Iterator producers;
    if (numProducers <= 0) {
        return (null);
    }
    ids = new String[numProducers];
    producers = Producer.getAllProducers();
    int i = 0;
    while (producers.hasNext()) {
        Producer oneProd = (Producer) producers.next();
        long prodID = oneProd.getProducerUID().longValue();
        ids[i] = Long.toString(prodID);
        i++;
    }
    return (ids);
}
Also used : Producer(com.sun.messaging.jmq.jmsserver.core.Producer) Iterator(java.util.Iterator)

Example 14 with Producer

use of com.sun.messaging.jmq.jmsserver.core.Producer in project openmq by eclipse-ee4j.

the class ProducerManagerConfig method getProducerIDs.

public String[] getProducerIDs() throws MBeanException {
    int numProducers = getNumProducers().intValue();
    String[] ids;
    Iterator producers;
    if (numProducers <= 0) {
        return (null);
    }
    ids = new String[numProducers];
    producers = Producer.getAllProducers();
    int i = 0;
    while (producers.hasNext()) {
        Producer oneProd = (Producer) producers.next();
        long prodID = oneProd.getProducerUID().longValue();
        String id;
        try {
            id = Long.toString(prodID);
            ids[i] = id;
        } catch (Exception ex) {
            handleOperationException(ProducerOperations.GET_PRODUCER_IDS, ex);
        }
        i++;
    }
    return (ids);
}
Also used : Producer(com.sun.messaging.jmq.jmsserver.core.Producer) Iterator(java.util.Iterator) MBeanException(javax.management.MBeanException)

Example 15 with Producer

use of com.sun.messaging.jmq.jmsserver.core.Producer in project openmq by eclipse-ee4j.

the class ProducerManagerMonitor method getProducerWildcards.

public String[] getProducerWildcards() throws MBeanException {
    ArrayList<String> al = new ArrayList<>();
    String[] list = null;
    int numWildcardProducers = Producer.getNumWildcardProducers();
    Iterator producers;
    if (numWildcardProducers <= 0) {
        return (null);
    }
    producers = Producer.getWildcardProducers();
    if (producers == null) {
        return (null);
    }
    while (producers.hasNext()) {
        ProducerUID pid = (ProducerUID) producers.next();
        Producer oneProd = (Producer) Producer.getProducer(pid);
        DestinationUID id = oneProd.getDestinationUID();
        al.add(id.getName());
    }
    if (al.size() > 0) {
        list = new String[al.size()];
        list = al.toArray(list);
    }
    return (list);
}
Also used : DestinationUID(com.sun.messaging.jmq.jmsserver.core.DestinationUID) Producer(com.sun.messaging.jmq.jmsserver.core.Producer) ProducerUID(com.sun.messaging.jmq.jmsserver.core.ProducerUID) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator)

Aggregations

Producer (com.sun.messaging.jmq.jmsserver.core.Producer)18 DestinationUID (com.sun.messaging.jmq.jmsserver.core.DestinationUID)9 Iterator (java.util.Iterator)7 Destination (com.sun.messaging.jmq.jmsserver.core.Destination)6 ProducerUID (com.sun.messaging.jmq.jmsserver.core.ProducerUID)5 ConnectionUID (com.sun.messaging.jmq.jmsserver.service.ConnectionUID)5 BrokerException (com.sun.messaging.jmq.jmsserver.util.BrokerException)5 ArrayList (java.util.ArrayList)3 Hashtable (java.util.Hashtable)3 Consumer (com.sun.messaging.jmq.jmsserver.core.Consumer)2 MessageDeliveryTimeInfo (com.sun.messaging.jmq.jmsserver.core.MessageDeliveryTimeInfo)2 PacketReference (com.sun.messaging.jmq.jmsserver.core.PacketReference)2 Session (com.sun.messaging.jmq.jmsserver.core.Session)2 SessionUID (com.sun.messaging.jmq.jmsserver.core.SessionUID)2 ConnectionInfo (com.sun.messaging.jmq.util.admin.ConnectionInfo)2 SelectorFormatException (com.sun.messaging.jmq.util.selector.SelectorFormatException)2 IOException (java.io.IOException)2 Set (java.util.Set)2 Packet (com.sun.messaging.jmq.io.Packet)1 FaultInjection (com.sun.messaging.jmq.jmsserver.FaultInjection)1