mirror of https://github.com/apache/activemq.git
added cleaner logging, particularly when starting a slave (its good to tell the user that its looking for the exclusive lock so they know the broker is not just hanging for nothing :)
git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@425114 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
29081a8b10
commit
71154628f8
|
@ -46,14 +46,13 @@ public class DefaultDatabaseLocker implements DatabaseLocker {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start() throws Exception {
|
public void start() throws Exception {
|
||||||
log.debug("Attempting to acquire exclusive lock on the database");
|
|
||||||
|
|
||||||
connection = dataSource.getConnection();
|
connection = dataSource.getConnection();
|
||||||
connection.setAutoCommit(false);
|
connection.setAutoCommit(false);
|
||||||
|
|
||||||
PreparedStatement statement = connection.prepareStatement(statements.getLockCreateStatement());
|
PreparedStatement statement = connection.prepareStatement(statements.getLockCreateStatement());
|
||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
|
log.info("Attempting to acquire the exclusive lock to become the Master broker");
|
||||||
boolean answer = statement.execute();
|
boolean answer = statement.execute();
|
||||||
if (answer) {
|
if (answer) {
|
||||||
break;
|
break;
|
||||||
|
@ -62,7 +61,7 @@ public class DefaultDatabaseLocker implements DatabaseLocker {
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
log.error("Failed to acquire lock: " + e, e);
|
log.error("Failed to acquire lock: " + e, e);
|
||||||
}
|
}
|
||||||
log.info("Sleeping for " + sleepTime + " milli(s) before trying again to get the lock...");
|
log.debug("Sleeping for " + sleepTime + " milli(s) before trying again to get the lock...");
|
||||||
Thread.sleep(sleepTime);
|
Thread.sleep(sleepTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue