{
// before we do anything else, make sure we dont have any
// unexpected exceptions
// FIRST ... look at transaction table (tid,state)
LoadException load_ex = Globals.getStore().getLoadTransactionException();
if (load_ex != null) {
// some messages could not be loaded
LoadException processing = load_ex;
while (processing != null) {
TransactionUID tid = (TransactionUID)processing.getKey();
TransactionInfo ti = (TransactionInfo)processing.getValue();
if (tid == null && ti == null) {
logger.log(Logger.WARNING, BrokerResources.E_INTERNAL_ERROR,
"Both key and value for a transactions entry"
+ " are corrupted with key exception "+
processing.getKeyCause().getMessage()+
" and value exception "+ processing.getValueCause());
processing = processing.getNextException();
continue;
}
if (tid == null ) {
// at this point, there is nothing we can do ...
// store with valid key
// improve when we address 5060661
logger.logStack(Logger.WARNING, BrokerResources.W_TRANS_ID_CORRUPT,
ti.toString(), processing.getKeyCause());
processing = processing.getNextException();
continue;
}
if (ti == null) {
// if we dont know ... so make it prepared
logger.log(Logger.WARNING, Globals.getBrokerResources().getKString(
BrokerResources.W_TRAN_INFO_CORRUPTED, tid.toString()));
TransactionState ts = new TransactionState(
AutoRollbackType.NOT_PREPARED, 0, true);
ts.setState(TransactionState.PREPARED);
try {
store.storeTransaction(tid, ts, false);
} catch (Exception ex) {
logger.logStack(Logger.WARNING, BrokerResources.E_INTERNAL_ERROR,
"Error updating transaction " + tid, ex);
}
processing = processing.getNextException();
continue;
}
if (ti.getType() == TransactionInfo.TXN_NOFLAG) {
logger.logStack(Logger.WARNING, Globals.getBrokerResources().getKString(
BrokerResources.W_TXN_TYPE_CORRUPTED, tid+"["+ti.toString()+"]",
TransactionInfo.toString(TransactionInfo.TXN_LOCAL)),
processing.getValueCause());
TransactionState ts = new TransactionState(
AutoRollbackType.NOT_PREPARED, 0, true);
ts.setState(TransactionState.PREPARED);
try {
store.storeTransaction(tid, ts, false);
} catch (Exception ex) {
logger.logStack(Logger.WARNING, BrokerResources.E_INTERNAL_ERROR,
"Error updating transaction " + tid, ex);
}
processing = processing.getNextException();
continue;
}
if (ti.getTransactionState() == null) {
logger.log(Logger.WARNING, BrokerResources.W_TRANS_STATE_CORRUPT,
tid, processing.getValueCause());
TransactionState ts = new TransactionState(
AutoRollbackType.NOT_PREPARED, 0, true);
ts.setState(TransactionState.PREPARED);
try {
store.storeTransaction(tid, ts, false);
} catch (Exception ex) {
logger.logStack(Logger.WARNING, BrokerResources.E_INTERNAL_ERROR,
"Error updating transaction " + tid, ex);
}
processing = processing.getNextException();
continue;
}
if (ti.getType() == TransactionInfo.TXN_CLUSTER && ti.getTransactionBrokers() == null) {
logger.log(Logger.WARNING, BrokerResources.W_CLUSTER_TXN_BROKER_INFO_CORRUPTED,
tid, processing.getValueCause());
store.storeClusterTransaction(tid, ti.getTransactionState(), null, false);
processing = processing.getNextException();
continue;
}
if (ti.getType() == TransactionInfo.TXN_REMOTE &&
ti.getTransactionHomeBroker() == null) {
logger.log(Logger.WARNING, BrokerResources.W_REMOTE_TXN_HOME_BROKER_INFO_CORRUPTED,
tid, processing.getValueCause());
store.storeRemoteTransaction(tid, ti.getTransactionState(), null, null, false);
processing = processing.getNextException();
continue;
}
logger.log(Logger.ERROR, "XXXI18N Internal Error: unknown load error for TUID="
+tid+"["+ti.toString()+"]");
} // end while
}
// now look at acks load exception
load_ex = Globals.getStore().getLoadTransactionAckException();
if (load_ex != null) {
// some messages could not be loaded
LoadException processing = load_ex;
while (processing != null) {
TransactionUID tid = (TransactionUID)processing.getKey();
TransactionAcknowledgement ta[] =
(TransactionAcknowledgement[])processing.getValue();
if (tid == null && ta == null) {
logger.log(Logger.WARNING,
BrokerResources.E_INTERNAL_ERROR,
"both key and value for a Transaction Ack entry"
+ " are corrupted");
processing = processing.getNextException();
continue;
}
if (tid == null ) {
// at this point, there is nothing we can do ...
// store with valid key
// improve when we address 5060661
logger.log(Logger.WARNING,
BrokerResources.W_TRANS_ID_CORRUPT,
ta.toString());
processing = processing.getNextException();
continue;
}
//ta == null, nothing we can do, remove it
logger.log(Logger.WARNING,
BrokerResources.W_TRANS_ACK_CORRUPT,