Search in sources :

Example 56 with BrokerAdmin

use of com.sun.messaging.jmq.admin.bkrutil.BrokerAdmin in project openmq by eclipse-ee4j.

the class BrokerAdminHandler method doResumeDest.

private void doResumeDest(BrokerDestCObj bDestCObj) {
    BrokerAdmin ba = bDestCObj.getBrokerAdmin();
    DestinationInfo destInfo = bDestCObj.getDestinationInfo();
    int result = JOptionPane.showConfirmDialog(app.getFrame(), acr.getString(acr.Q_DEST_RESUME, destInfo.name, ba.getKey()), acr.getString(acr.I_RESUME_DEST), JOptionPane.YES_NO_OPTION);
    if (result == JOptionPane.NO_OPTION) {
        return;
    }
    /*
         * Broker may take more time to complete the task than the specified timeout value. This value is used when refreshing
         * the console in such cases.
         */
    if (!ba.isBusy()) {
        ba.setAssociatedObj(bDestCObj);
    }
    if (resumeDest(ba, destInfo.name, destInfo.type)) {
        destInfo = queryDestinationInfo(ba, destInfo.name, destInfo.type);
        if (destInfo != null) {
            bDestCObj.setDestinationInfo(destInfo);
            app.getInspector().selectedObjectUpdated();
        }
        // Update menu items, buttons.
        controller.setActions(bDestCObj);
    }
}
Also used : BrokerAdmin(com.sun.messaging.jmq.admin.bkrutil.BrokerAdmin) DestinationInfo(com.sun.messaging.jmq.util.admin.DestinationInfo)

Example 57 with BrokerAdmin

use of com.sun.messaging.jmq.admin.bkrutil.BrokerAdmin in project openmq by eclipse-ee4j.

the class BrokerAdminHandler method doPauseDest.

private void doPauseDest(BrokerDestCObj bDestCObj) {
    BrokerAdmin ba = bDestCObj.getBrokerAdmin();
    DestinationInfo destInfo = bDestCObj.getDestinationInfo();
    int result = JOptionPane.showConfirmDialog(app.getFrame(), acr.getString(acr.Q_DEST_PAUSE, destInfo.name, ba.getKey()), acr.getString(acr.I_PAUSE_DEST), JOptionPane.YES_NO_OPTION);
    if (result == JOptionPane.NO_OPTION) {
        return;
    }
    /*
         * Broker may take more time to complete the task than the specified timeout value. This value is used when refreshing
         * the console in such cases.
         */
    if (!ba.isBusy()) {
        ba.setAssociatedObj(bDestCObj);
    }
    if (pauseDest(ba, destInfo.name, destInfo.type, DestState.PAUSED)) {
        destInfo = queryDestinationInfo(ba, destInfo.name, destInfo.type);
        if (destInfo != null) {
            bDestCObj.setDestinationInfo(destInfo);
            app.getInspector().selectedObjectUpdated();
        }
        // Update menu items, buttons.
        controller.setActions(bDestCObj);
    }
}
Also used : BrokerAdmin(com.sun.messaging.jmq.admin.bkrutil.BrokerAdmin) DestinationInfo(com.sun.messaging.jmq.util.admin.DestinationInfo)

Example 58 with BrokerAdmin

use of com.sun.messaging.jmq.admin.bkrutil.BrokerAdmin in project openmq by eclipse-ee4j.

the class BrokerAdminHandler method doPauseAllDests.

private void doPauseAllDests(BrokerDestListCObj bDestListCObj) {
    BrokerAdmin ba = bDestListCObj.getBrokerAdmin();
    int result = JOptionPane.showConfirmDialog(app.getFrame(), acr.getString(acr.Q_DEST_PAUSE_ALL, ba.getKey()), acr.getString(acr.I_PAUSE_ALL_DESTS), JOptionPane.YES_NO_OPTION);
    if (result == JOptionPane.NO_OPTION) {
        return;
    }
    /*
         * Broker may take more time to complete the task than the specified timeout value. This value is used when refreshing
         * the console in such cases.
         */
    if (!ba.isBusy()) {
        ba.setAssociatedObj(bDestListCObj);
    }
    if (pauseAllDests(ba, DestType.DEST_TYPE_QUEUE, DestState.PAUSED)) {
        if (!populateBrokerDestinations((BrokerCObj) bDestListCObj.getParent())) {
            return;
        }
        // Update menu items, buttons.
        controller.setActions(bDestListCObj);
        app.getInspector().refresh();
    }
}
Also used : BrokerAdmin(com.sun.messaging.jmq.admin.bkrutil.BrokerAdmin)

Example 59 with BrokerAdmin

use of com.sun.messaging.jmq.admin.bkrutil.BrokerAdmin in project openmq by eclipse-ee4j.

the class BrokerAdminHandler method refreshBrokerServiceCObj.

private boolean refreshBrokerServiceCObj(BrokerServiceCObj bSvcCObj) {
    ServiceInfo oldSvcInfo = bSvcCObj.getServiceInfo();
    BrokerAdmin ba = bSvcCObj.getBrokerAdmin();
    /*
         * Broker may take more time to complete the task than the specified timeout value. This value is used when refreshing
         * the console in such cases.
         */
    if (!ba.isBusy()) {
        ba.setAssociatedObj(bSvcCObj);
    }
    Vector svc = null;
    try {
        ba.sendGetServicesMessage(oldSvcInfo.name);
        /*
             * False because users do not need to know whether or not the operation had succeeded after timeout.
             */
        svc = ba.receiveGetServicesReplyMessage(false);
    } catch (BrokerAdminException baex) {
        JOptionPane.showOptionDialog(app.getFrame(), acr.getString(acr.E_RETRIEVE_SVC, oldSvcInfo.name) + printBrokerAdminExceptionDetails(baex), acr.getString(acr.I_BROKER_SVC_PROPS) + ": " + acr.getString(acr.I_ERROR_CODE, AdminConsoleResources.E_RETRIEVE_SVC), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, close, close[0]);
        return false;
    }
    if ((svc != null) && (svc.size() == 1)) {
        Enumeration e = svc.elements();
        ServiceInfo sInfo = (ServiceInfo) e.nextElement();
        bSvcCObj.setServiceInfo(sInfo);
        return true;
    }
    return false;
}
Also used : ServiceInfo(com.sun.messaging.jmq.util.admin.ServiceInfo) BrokerAdminException(com.sun.messaging.jmq.admin.bkrutil.BrokerAdminException) BrokerAdmin(com.sun.messaging.jmq.admin.bkrutil.BrokerAdmin) Enumeration(java.util.Enumeration) Vector(java.util.Vector)

Example 60 with BrokerAdmin

use of com.sun.messaging.jmq.admin.bkrutil.BrokerAdmin in project openmq by eclipse-ee4j.

the class BrokerAdminHandler method reconnectToBroker.

private boolean reconnectToBroker(BrokerCObj bCObj) throws BrokerAdminException {
    BrokerAdmin ba = bCObj.getBrokerAdmin();
    boolean connected = false;
    int count = 0;
    while (!connected && (count < BrokerAdmin.RECONNECT_RETRIES)) {
        try {
            count++;
            ba.connect();
            ba.sendHelloMessage();
            ba.receiveHelloReplyMessage();
            connected = true;
            /*
                 * Add a listener to unexpected error reporting only after a successful connect. Set the initiator to false. This flag
                 * should only be set to true when it is ready to preform a shutdown.
                 */
            ba.addAdminEventListener(this);
            ba.setInitiator(false);
        } catch (BrokerAdminException baex) {
            // try to reconnect based on RECONNECT attributes
            if (baex.getType() == BrokerAdminException.CONNECT_ERROR) {
                try {
                    Thread.sleep(BrokerAdmin.RECONNECT_DELAY);
                } catch (InterruptedException ie) {
                    JOptionPane.showOptionDialog(app.getFrame(), acr.getString(acr.E_RECONNECT_BROKER, ba.getKey()) + ie, acr.getString(acr.I_BROKER) + ": " + acr.getString(acr.I_ERROR_CODE, AdminConsoleResources.E_RECONNECT_BROKER), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, close, close[0]);
                    // Update the node
                    app.getExplorer().nodeChanged(bCObj);
                    // Update menu items, buttons.
                    controller.setActions(bCObj);
                }
            } else {
                JOptionPane.showOptionDialog(app.getFrame(), acr.getString(acr.E_RECONNECT_BROKER, ba.getKey()) + baex, acr.getString(acr.I_BROKER) + ": " + acr.getString(acr.I_ERROR_CODE, AdminConsoleResources.E_RECONNECT_BROKER), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, close, close[0]);
                // Update the node
                app.getExplorer().nodeChanged(bCObj);
                // Update menu items, buttons.
                controller.setActions(bCObj);
            }
        } catch (Exception ex) {
            JOptionPane.showOptionDialog(app.getFrame(), acr.getString(acr.E_RECONNECT_BROKER, ba.getKey()) + ex, acr.getString(acr.I_BROKER) + ": " + acr.getString(acr.I_ERROR_CODE, AdminConsoleResources.E_RECONNECT_BROKER), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, close, close[0]);
            // Update the node
            app.getExplorer().nodeChanged(bCObj);
            // Update menu items, buttons.
            controller.setActions(bCObj);
        }
        if (count >= BrokerAdmin.RECONNECT_RETRIES) {
            JOptionPane.showOptionDialog(app.getFrame(), acr.getString(acr.E_RECONNECT), acr.getString(acr.I_CONNECT_BROKER) + ": " + acr.getString(acr.I_ERROR_CODE, AdminConsoleResources.E_RECONNECT), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, close, close[0]);
            // Update the node
            app.getExplorer().nodeChanged(bCObj);
            // Update menu items, buttons.
            controller.setActions(bCObj);
        }
    }
    return connected;
}
Also used : BrokerAdminException(com.sun.messaging.jmq.admin.bkrutil.BrokerAdminException) BrokerAdmin(com.sun.messaging.jmq.admin.bkrutil.BrokerAdmin) BrokerAdminException(com.sun.messaging.jmq.admin.bkrutil.BrokerAdminException)

Aggregations

BrokerAdmin (com.sun.messaging.jmq.admin.bkrutil.BrokerAdmin)69 BrokerAdminException (com.sun.messaging.jmq.admin.bkrutil.BrokerAdminException)44 SizeString (com.sun.messaging.jmq.util.SizeString)27 Vector (java.util.Vector)20 DestinationInfo (com.sun.messaging.jmq.util.admin.DestinationInfo)14 Enumeration (java.util.Enumeration)14 Properties (java.util.Properties)12 ServiceInfo (com.sun.messaging.jmq.util.admin.ServiceInfo)9 Hashtable (java.util.Hashtable)6 DurableInfo (com.sun.messaging.jmq.util.admin.DurableInfo)2 HashMap (java.util.HashMap)2 UserProperties (com.sun.messaging.jmq.admin.util.UserProperties)1 DestMetricsCounters (com.sun.messaging.jmq.util.DestMetricsCounters)1 MetricCounters (com.sun.messaging.jmq.util.MetricCounters)1 ConsumerInfo (com.sun.messaging.jmq.util.admin.ConsumerInfo)1 Message (jakarta.jms.Message)1 Map (java.util.Map)1