Package com.google.common.base

Examples of com.google.common.base.FinalizableReferenceQueue


#endif JDK5 */

      }
    }
    if (!config.isDisableConnectionTracking()){
      this.finalizableRefQueue = new FinalizableReferenceQueue();
    }
   
    this.asyncExecutor = Executors.newCachedThreadPool();
    int helperThreads = config.getReleaseHelperThreads();
    this.releaseHelperThreadsConfigured = helperThreads > 0;
View Full Code Here


        packageNamespaceDefinitionCache = new PackageNamespaceDefinitionCache();
        embedDataCache = new WeakHashMap<EmbedData, EmbedData>();
        embedLock = new ReentrantReadWriteLock();

        invisibleCompilationUnitReferenceQueue = new FinalizableReferenceQueue();

        asDocDelegate = NilASDocDelegate.get();
       
        buildSync = new BuildSynchronizationState();
    }
View Full Code Here

    testClass.setFreeConnections(freeConnections);
    assertEquals(freeConnections, testClass.getFreeConnections());
    reset(this.mockPool);
    Map<Connection, Reference<ConnectionHandle>> refs = new HashMap<Connection, Reference<ConnectionHandle>>();
    expect(this.mockPool.getFinalizableRefs()).andReturn(refs).anyTimes();
    FinalizableReferenceQueue finalizableRefQueue = new FinalizableReferenceQueue();
    expect(this.mockPool.getFinalizableRefQueue()).andReturn(finalizableRefQueue).anyTimes();

    ConnectionHandle mockConnectionHandle = createNiceMock(ConnectionHandle.class);
    expect(mockConnectionHandle.getPool()).andReturn(this.mockPool).anyTimes();
    expect(freeConnections.offer(mockConnectionHandle)).andReturn(true).anyTimes();
View Full Code Here

    assertEquals(freeConnections, testClass.getFreeConnections());
    reset(this.mockPool);
    Map<Connection, Reference<ConnectionHandle>> refs = new HashMap<Connection, Reference<ConnectionHandle>>();
    expect(this.mockPool.getFinalizableRefs()).andReturn(refs).anyTimes();
   
    FinalizableReferenceQueue finalizableRefQueue = new FinalizableReferenceQueue();
    expect(this.mockPool.getFinalizableRefQueue()).andReturn(finalizableRefQueue).anyTimes();
    ConnectionHandle mockConnectionHandle = createNiceMock(ConnectionHandle.class);
    expect(mockConnectionHandle.getPool()).andReturn(this.mockPool).anyTimes();
    expect(freeConnections.offer(mockConnectionHandle)).andReturn(false);
   
View Full Code Here

    mockConnection.close();
    expectLastCall().once();
    reset(this.mockPool, this.mockConfig);
    Map<Connection, Reference<ConnectionHandle>> refs = new HashMap<Connection, Reference<ConnectionHandle>>();
    expect(this.mockPool.getFinalizableRefs()).andReturn(refs).anyTimes();
    FinalizableReferenceQueue finalizableRefQueue = new FinalizableReferenceQueue();
    expect(this.mockPool.getFinalizableRefQueue()).andReturn(finalizableRefQueue).anyTimes();
    expect(mockConnectionHandle.getPool()).andReturn(this.mockPool).anyTimes();
    expect(this.mockPool.getConfig()).andReturn(mockConfig).anyTimes();
    expect(mockConfig.getPoolName()).andReturn("foo").once();
    makeThreadSafe(this.mockPool, true);
View Full Code Here

    mockConnection.close();
    expectLastCall().andThrow(new SQLException("fake reason")).once();
    reset(this.mockPool);
    Map<Connection, Reference<ConnectionHandle>> refs = new HashMap<Connection, Reference<ConnectionHandle>>();
    expect(this.mockPool.getFinalizableRefs()).andReturn(refs).anyTimes();
    FinalizableReferenceQueue finalizableRefQueue = new FinalizableReferenceQueue();
    expect(this.mockPool.getFinalizableRefQueue()).andReturn(finalizableRefQueue).anyTimes();
    expect(mockConnectionHandle.getPool()).andReturn(this.mockPool).anyTimes();

    replay(mockConnectionHandle, mockConnection, this.mockPool);
    testClass.trackConnectionFinalizer(mockConnectionHandle);
View Full Code Here

    reset(mockLogger);
    makeThreadSafe(mockLogger, true);
    reset(this.mockPool);
    Map<Connection, Reference<ConnectionHandle>> refs = new HashMap<Connection, Reference<ConnectionHandle>>();
    expect(this.mockPool.getFinalizableRefs()).andReturn(refs).anyTimes();
    FinalizableReferenceQueue finalizableRefQueue = new FinalizableReferenceQueue();
    expect(this.mockPool.getFinalizableRefQueue()).andReturn(finalizableRefQueue).anyTimes();
    expect(mockConnectionHandle.getPool()).andReturn(this.mockPool).anyTimes();

    replay(mockConnection, mockConnectionHandle, this.mockPool);
View Full Code Here

   
    BoneCP mockPool = EasyMock.createNiceMock(BoneCP.class);
    CachedConnectionStrategy ccs = new CachedConnectionStrategy(mockPool , new DefaultConnectionStrategy(mockPool));
    ConnectionHandle mockConnection = EasyMock.createNiceMock(ConnectionHandle.class);
    mockConnection.logicallyClosed = new AtomicBoolean(true);
    ccs.threadFinalizableRefs.put(mockConnection, new FinalizableWeakReference<Thread>(Thread.currentThread(), new FinalizableReferenceQueue()) {
      public void finalizeReferent() {
    }
  });
   
    mockPool.releaseConnection((Connection)EasyMock.anyObject());
View Full Code Here

    this.mockConnection.close();
    expectLastCall().once().andThrow(new SQLException()).once();

    Map<Connection, Reference<ConnectionHandle>> refs = new HashMap<Connection, Reference<ConnectionHandle>>();
    expect(this.mockPool.getFinalizableRefs()).andReturn(refs).anyTimes();
    FinalizableReferenceQueue finalizableRefQueue = new FinalizableReferenceQueue();

    expect(this.mockPool.getFinalizableRefQueue()).andReturn(finalizableRefQueue).anyTimes();
    expect(this.mockConnection.getPool()).andReturn(this.mockPool).anyTimes();

    Field f = this.testClass.getClass().getDeclaredField("finalizableRefs");
View Full Code Here

        throw PoolUtil.generateSQLException(String.format(ERROR_TEST_CONNECTION, this.config.getJdbcUrl(), this.config.getUsername(), PoolUtil.stringifyException(e)), e);

      }
    }
    if (!this.config.isDisableConnectionTracking()){
      this.finalizableRefQueue = new FinalizableReferenceQueue();
    }

    this.asyncExecutor = MoreExecutors.listeningDecorator(Executors.newCachedThreadPool());

    this.partitions = new ConnectionPartition[this.config.getPartitionCount()];
View Full Code Here

TOP

Related Classes of com.google.common.base.FinalizableReferenceQueue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.