diff -r ed84c8bdd87b -r f5b57e221e38 src/org/sonews/daemon/AbstractDaemon.java --- a/src/org/sonews/daemon/AbstractDaemon.java Sun Aug 29 17:28:58 2010 +0200 +++ b/src/org/sonews/daemon/AbstractDaemon.java Thu Jul 05 13:19:19 2012 +0200 @@ -32,70 +32,63 @@ public abstract class AbstractDaemon extends Thread { - /** This variable is write synchronized through setRunning */ - private boolean isRunning = false; + /** This variable is write synchronized through setRunning */ + private boolean isRunning = false; - /** - * Protected constructor. Will be called by derived classes. - */ - protected AbstractDaemon() - { - setDaemon(true); // VM will exit when all threads are daemons - setName(getClass().getSimpleName()); - } - - /** - * @return true if shutdown() was not yet called. - */ - public boolean isRunning() - { - synchronized(this) - { - return this.isRunning; - } - } - - /** - * Marks this thread to exit soon. Closes the associated JDBCDatabase connection - * if available. - * @throws java.sql.SQLException - */ - public void shutdownNow() - throws SQLException - { - synchronized(this) - { - this.isRunning = false; - StorageManager.disableProvider(); - } - } - - /** - * Calls shutdownNow() but catches SQLExceptions if occurring. - */ - public void shutdown() - { - try - { - shutdownNow(); - } - catch(SQLException ex) - { - Log.get().warning(ex.toString()); - } - } - - /** - * Starts this daemon. - */ - @Override - public void start() - { - synchronized(this) - { - this.isRunning = true; - } - super.start(); - } - + /** + * Protected constructor. Will be called by derived classes. + */ + protected AbstractDaemon() + { + setDaemon(true); // VM will exit when all threads are daemons + setName(getClass().getSimpleName()); + } + + /** + * @return true if shutdown() was not yet called. + */ + public boolean isRunning() + { + synchronized (this) { + return this.isRunning; + } + } + + /** + * Marks this thread to exit soon. Closes the associated JDBCDatabase connection + * if available. + * @throws java.sql.SQLException + */ + public void shutdownNow() + throws SQLException + { + synchronized (this) { + this.isRunning = false; + StorageManager.disableProvider(); + } + } + + /** + * Calls shutdownNow() but catches SQLExceptions if occurring. + */ + public void shutdown() + { + try { + shutdownNow(); + } catch (SQLException ex) { + Log.get().warning(ex.toString()); + } + } + + /** + * Starts this daemon. + */ + @Override + public void start() + { + synchronized (this) { + this.isRunning = true; + } + super.start(); + } }