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