Example #1
0
 public static synchronized void markClosed(PooledDataSource pds) {
   unclosedPooledDataSources.remove(pds);
   mc.attemptUnmanagePooledDataSource(pds);
   if (unclosedPooledDataSources.isEmpty()) {
     mc.attemptUnmanageC3P0Registry();
     registry_mbean_registered = false;
   }
 }
Example #2
0
 /**
  * <b>Note:</b> If multiple PooledDataSources in your JVM share the same <tt>dataSourceName</tt>,
  * which of those multiple DataSources will be returned by this method is undefined!
  *
  * @return a PooledDataSource with the given <tt>dataSourceName</tt>, if at least one exists.
  *     <tt>null</tt> otherwise.
  */
 public static synchronized PooledDataSource pooledDataSourceByName(String dataSourceName) {
   for (Iterator ii = unclosedPooledDataSources.iterator(); ii.hasNext(); ) {
     PooledDataSource pds = (PooledDataSource) ii.next();
     if (pds.getDataSourceName().equals(dataSourceName)) return pds;
   }
   return null;
 }
Example #3
0
 // must be called with class' lock
 private static void incorporate(IdentityTokenized idt) {
   tokensToTokenized.put(idt.getIdentityToken(), idt);
   if (idt instanceof PooledDataSource) {
     unclosedPooledDataSources.add(idt);
     mc.attemptManagePooledDataSource((PooledDataSource) idt);
   }
 }
Example #4
0
 public synchronized int getNumThreadsAllThreadPools() throws SQLException {
   int count = 0;
   for (Iterator ii = unclosedPooledDataSources.iterator(); ii.hasNext(); ) {
     PooledDataSource pds = (PooledDataSource) ii.next();
     count += pds.getNumHelperThreads();
   }
   return count;
 }
Example #5
0
 /** @return the set of all PooledDataSources sharing the given dataSourceName */
 public static synchronized Set pooledDataSourcesByName(String dataSourceName) {
   Set out = new HashSet();
   for (Iterator ii = unclosedPooledDataSources.iterator(); ii.hasNext(); ) {
     PooledDataSource pds = (PooledDataSource) ii.next();
     if (pds.getDataSourceName().equals(dataSourceName)) out.add(pds);
   }
   return out;
 }
Example #6
0
 public static synchronized int getNumPooledDataSources() {
   return unclosedPooledDataSources.size();
 }
Example #7
0
 public static synchronized Set allIdentityTokenized() {
   HashSet out = new HashSet();
   out.addAll(tokensToTokenized.values());
   // System.err.println( "allIdentityTokenized(): " + out );
   return Collections.unmodifiableSet(out);
 }
Example #8
0
 public static synchronized Set getPooledDataSources() {
   return (Set) unclosedPooledDataSources.clone();
 }