logger.log(Logger.ERROR, this.getClass().getName() + ": " + errMsg);
} else {
try {
if (destination != null) {
// compact one destination
Destination d = Destination.getDestination(destination,
DestType.isQueue(type.intValue()));
if (d != null) {
if (d.isPaused()) {
d.compact();
} else {
status = Status.ERROR;
String msg = rb.getString(rb.E_DESTINATION_NOT_PAUSED);
errMsg = rb.getString(rb.X_COMPACT_DST_EXCEPTION,
destination, msg);
logger.log(Logger.ERROR, errMsg);
}
} else {
status = Status.ERROR;
String subError = rb.getString(rb.E_NO_SUCH_DESTINATION,
getDestinationType(type.intValue()),
destination);
errMsg = rb.getString(rb.X_COMPACT_DST_EXCEPTION,
destination, subError);
logger.log(Logger.ERROR, errMsg);
}
} else {
Iterator itr = Destination.getAllDestinations();
boolean docompact = true;
while (itr.hasNext()) {
// make sure all are paused
Destination d = (Destination)itr.next();
/*
* Skip internal, admin, or temp destinations.
* Skipping temp destinations may need to be
* revisited.
*/
if (d.isInternal() || d.isAdmin() || d.isTemporary()) {
continue;
}
if (!d.isPaused()) {
docompact = false;
status = Status.ERROR;
String msg = rb.getString(
rb.E_SOME_DESTINATIONS_NOT_PAUSED);
errMsg = rb.getString(rb.X_COMPACT_DSTS_EXCEPTION,
msg);
logger.log(Logger.ERROR, errMsg);
}
}
if (docompact) {
itr = Destination.getAllDestinations();
while (itr.hasNext()) {
Destination d = (Destination)itr.next();
/*
* Skip internal, admin, or temp destinations.
* Skipping temp destinations may need to be
* revisited.
*/
if (d.isInternal() || d.isAdmin() || d.isTemporary()) {
continue;
}
d.compact();
}
}
}
} catch (Exception e) {
status = Status.ERROR;