log.info("The DbWatcher has been successfully restarted");
}
}
private static DbWatcher initializeDbWatcher(I_Info readerInfo, DbWriter dbWriter) throws Exception {
DbWatcher dbWatcher = null;
if (readerInfo != null) {
try {
log.info("setUp: Instantiating DbWatcher");
GlobalInfo.setStrippedHostname(readerInfo, GlobalInfo.UPPER_CASE);
dbWatcher = new DbWatcher();
dbWatcher.init(readerInfo);
I_DbSpecific dbSpecific = null;
if (readerInfo != null) {
if (readerInfo.getBoolean("replication.doBootstrap", false)) {
boolean needsPublisher = readerInfo.getBoolean(I_DbSpecific.NEEDS_PUBLISHER_KEY, true);
boolean forceCreationAndInitNo = false;
dbSpecific = ReplicationConverter.getDbSpecific(readerInfo, forceCreationAndInitNo); // done only on master !!!
readerInfo.put(I_DbSpecific.NEEDS_PUBLISHER_KEY, "" + needsPublisher); // back to original
I_DbPool pool = (I_DbPool)readerInfo.getObject("db.pool");
if (pool == null)
throw new Exception("ReplicationAgent.init: the db pool is null");
Connection conn = pool.reserve();
try {
boolean doWarn = false;
boolean force = false;
dbSpecific.bootstrap(conn, doWarn, force);
}
catch (Exception ex) {
conn = SpecificDefault.removeFromPool(conn, SpecificDefault.ROLLBACK_YES, pool);
}
finally {
conn = SpecificDefault.releaseIntoPool(conn, SpecificDefault.COMMIT_YES, pool);
}
}
}
dbWatcher.startAlertProducers();
}
catch (Exception ex) {
if (dbWriter != null) {
try {
dbWriter.shutdown();