Example #1
0
  public void shutdown() {

    shutdown = true;
    myThread.interrupt();
    List<DbConnectionBroker> br = new ArrayList<DbConnectionBroker>(registeredBrokers);
    for (DbConnectionBroker db : br) {
      try {
        db.destroy();
      } catch (Throwable t) {
        System.err.println("Problem shutting down broker: ");
        t.printStackTrace();
      }
    }
  }
Example #2
0
  public void run() {

    while (!shutdown) {
      try {
        synchronized (this) {
          wait(60000);
        }
        // Make copy to avoid concurrent modification exception.com
        Iterator<DbConnectionBroker> allBrokers =
            new HashSet<DbConnectionBroker>(registeredBrokers).iterator();
        while (allBrokers.hasNext()) {
          DbConnectionBroker inspectedBroker = allBrokers.next();
          inspectedBroker.refreshConnections();
        }
      } catch (Throwable t) {
        t.printStackTrace(System.err);
      } finally {

      }
    } // while true.
  }