private boolean refreshBrokerDestCObj(BrokerDestCObj bDestCObj) {
return refreshBrokerDestCObj(bDestCObj, -1);
}
private boolean refreshBrokerDestCObj(BrokerDestCObj bDestCObj, int eventType) {
DestinationInfo oldDestInfo = bDestCObj.getDestinationInfo();
BrokerAdmin ba = bDestCObj.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(bDestCObj);
Vector dests = null;
Vector durables = null;
boolean succeed = false;
try {
ba.sendGetDurablesMessage(oldDestInfo.name, null);
/*
* False because users do not need to know whether
* or not the operation had succeeded after timeout.
*/
durables = ba.receiveGetDurablesReplyMessage(false);
} catch (BrokerAdminException baex) {
JOptionPane.showOptionDialog(app.getFrame(),
acr.getString(acr.E_RETRIEVE_DUR, oldDestInfo.name) +
printBrokerAdminExceptionDetails(baex),
acr.getString(acr.I_BROKER_DEST_PROPS) + ": " +
acr.getString(acr.I_ERROR_CODE,
AdminConsoleResources.E_RETRIEVE_DUR),
JOptionPane.YES_NO_OPTION,
JOptionPane.ERROR_MESSAGE, null, close, close[0]);
return false;
}
if (durables.size() >= 0) {
bDestCObj.setDurables(durables);
succeed = true;
}
try {
ba.sendGetDestinationsMessage(oldDestInfo.name, oldDestInfo.type);
/*
* False because users do not need to know whether
* or not the operation had succeeded after timeout.
*/
dests = ba.receiveGetDestinationsReplyMessage(false);
} catch (BrokerAdminException baex) {
/*
*Do not pop up an error message, as another error message will be popped up.
*/
if (eventType == BrokerAdminEvent.DELETE_DUR ||
eventType == BrokerAdminEvent.UPDATE_DEST) {
return false;
}
JOptionPane.showOptionDialog(app.getFrame(),
acr.getString(acr.E_RETRIEVE_DEST, oldDestInfo.name) +
printBrokerAdminExceptionDetails(baex),
acr.getString(acr.I_BROKER_DEST_PROPS) + ": " +
acr.getString(acr.I_ERROR_CODE,
AdminConsoleResources.E_RETRIEVE_DEST),
JOptionPane.YES_NO_OPTION,
JOptionPane.ERROR_MESSAGE, null, close, close[0]);
return false;
}
if ((dests != null) && (dests.size() == 1)) {
Enumeration e = dests.elements();
DestinationInfo dInfo = (DestinationInfo)e.nextElement();
if ((!DestType.isTemporary(dInfo.type)) &&
(!DestType.isInternal(dInfo.fulltype)) &&
(!MessageType.JMQ_BRIDGE_ADMIN_DEST.equals(dInfo.name)) &&
(!MessageType.JMQ_ADMIN_DEST.equals(dInfo.name))) {
bDestCObj.setDestinationInfo(dInfo);