public synchronized void checkStatus() {
if (this.replPrefix == null)
return;
log.finest("invoked for '" + this.sessionName + "'");
I_AdminSession session = null;
try {
session = getSession();
}
catch (Exception ex) {
log.severe("an exception occured when retieving the session for '" + this.sessionName + "':" + ex.getMessage());
ex.printStackTrace();
return;
}
try {
this.cbQueueEntries = session.getCbQueueNumMsgs();
// this.messageSeq,
long[] transactionCountBeforeQueue = this.manager.getCurrentTransactionCount(this.replPrefix);
// check if the numbers in the queue are correct and fix it
long pubSubQueueEntries = 0L;
long maxTransSeq = transactionCountBeforeQueue[0];
if (transactionSeq == null) // then it is too early
return;
for (int i=0; i < this.transactionSeq.length; i++) {
pubSubQueueEntries += (transactionCountBeforeQueue[i] - this.transactionSeq[i]);
if (maxTransSeq < transactionCountBeforeQueue[i])
maxTransSeq = transactionCountBeforeQueue[i];
}
this.queueEntries = pubSubQueueEntries + this.ptpQueueEntries;
this.transactionSeqVisible = maxTransSeq - pubSubQueueEntries;
if (this.queueEntries != 0 && session != null && session.getCbQueueNumMsgs() == 0) {
log.warning("Detected wrong number of queue entries: correcting: ptp entries='" + this.ptpQueueEntries + "' total='" + this.queueEntries + "'");
this.ptpQueueEntries = 0L;
this.transactionSeq = (long[])transactionCountBeforeQueue.clone();
}
}
catch (Exception ex) {
log.severe("an exception occured when retieving the number of queue entries for '" + this.sessionName + "':" + ex.getMessage());
ex.printStackTrace();
this.queueEntries = -1L;
}
// isActive
try {
this.dispatcherActive = session.getDispatcherActive();
}
catch (Exception ex) {
log.severe("an exception occured when retieving the status of the dispatcher for '" + this.sessionName + "':" + ex.getMessage());
ex.printStackTrace();
this.dispatcherActive = false;
}
try {
I_AdminSession masterSession = this.manager.getMasterSession(this.replPrefix);
if (masterSession != null) {
if (masterSession.isStalled())
this.masterConn = CONN_STALLED;
else if (masterSession.getConnectionState().equals(ConnectionStateEnum.ALIVE.toString()))
this.masterConn = CONN_CONNECTED;
else
this.masterConn = CONN_DISCONNECTED;
}
else {