Whitespace-only code formatting changes.

This commit is contained in:
akwizgran
2015-11-30 09:38:25 +00:00
parent 1950c13ffb
commit 027ae8340f
202 changed files with 2993 additions and 2993 deletions

View File

@@ -50,19 +50,19 @@ class LifecycleManagerImpl implements LifecycleManager {
}
public void register(Service s) {
if(LOG.isLoggable(INFO))
if (LOG.isLoggable(INFO))
LOG.info("Registering service " + s.getClass().getName());
services.add(s);
}
public void registerForShutdown(ExecutorService e) {
if(LOG.isLoggable(INFO))
if (LOG.isLoggable(INFO))
LOG.info("Registering executor " + e.getClass().getName());
executors.add(e);
}
public StartResult startServices() {
if(!startStopSemaphore.tryAcquire()) {
if (!startStopSemaphore.tryAcquire()) {
LOG.info("Already starting or stopping");
return ALREADY_RUNNING;
}
@@ -71,35 +71,35 @@ class LifecycleManagerImpl implements LifecycleManager {
long now = clock.currentTimeMillis();
boolean reopened = db.open();
long duration = clock.currentTimeMillis() - now;
if(LOG.isLoggable(INFO)) {
if(reopened)
if (LOG.isLoggable(INFO)) {
if (reopened)
LOG.info("Reopening database took " + duration + " ms");
else LOG.info("Creating database took " + duration + " ms");
}
dbLatch.countDown();
for(Service s : services) {
for (Service s : services) {
now = clock.currentTimeMillis();
boolean started = s.start();
duration = clock.currentTimeMillis() - now;
if(!started) {
if(LOG.isLoggable(WARNING)) {
if (!started) {
if (LOG.isLoggable(WARNING)) {
String name = s.getClass().getName();
LOG.warning(name + " did not start");
}
return SERVICE_ERROR;
}
if(LOG.isLoggable(INFO)) {
if (LOG.isLoggable(INFO)) {
String name = s.getClass().getName();
LOG.info("Starting " + name + " took " + duration + " ms");
}
}
startupLatch.countDown();
return SUCCESS;
} catch(DbException e) {
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} catch (DbException e) {
if (LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
return DB_ERROR;
} catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} catch (IOException e) {
if (LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
return DB_ERROR;
} finally {
startStopSemaphore.release();
@@ -109,31 +109,31 @@ class LifecycleManagerImpl implements LifecycleManager {
public void stopServices() {
try {
startStopSemaphore.acquire();
} catch(InterruptedException e) {
} catch (InterruptedException e) {
LOG.warning("Interrupted while waiting to stop services");
return;
}
try {
LOG.info("Stopping services");
eventBus.broadcast(new ShutdownEvent());
for(Service s : services) {
for (Service s : services) {
boolean stopped = s.stop();
if(LOG.isLoggable(INFO)) {
if (LOG.isLoggable(INFO)) {
String name = s.getClass().getName();
if(stopped) LOG.info("Service stopped: " + name);
if (stopped) LOG.info("Service stopped: " + name);
else LOG.warning("Service failed to stop: " + name);
}
}
for(ExecutorService e : executors) e.shutdownNow();
if(LOG.isLoggable(INFO))
for (ExecutorService e : executors) e.shutdownNow();
if (LOG.isLoggable(INFO))
LOG.info(executors.size() + " executors shut down");
db.close();
LOG.info("Database closed");
shutdownLatch.countDown();
} catch(DbException e) {
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} catch (DbException e) {
if (LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} catch (IOException e) {
if (LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
} finally {
startStopSemaphore.release();
}

View File

@@ -41,7 +41,7 @@ class ShutdownManagerImpl implements ShutdownManager {
synchLock.lock();
try {
Thread hook = hooks.remove(handle);
if(hook == null) return false;
if (hook == null) return false;
else return Runtime.getRuntime().removeShutdownHook(hook);
} finally {
synchLock.unlock();