diff -r ed84c8bdd87b -r b78e77619152 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 Sun Sep 11 15:05:04 2011 +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(); + } }