Package com.jolbox.bonecp

Examples of com.jolbox.bonecp.ConnectionPartition


  @SuppressWarnings("unchecked")
  @Override
  public void onCheckOut(ConnectionHandle connection) {
    if (connection.getDebugHandle() == HACK_PARTITION_FLAG) {
      try {
        final ConnectionPartition partition = connection.getOriginatingPartition();
        final Method getFreeConnections = partition.getClass().getDeclaredMethod("getFreeConnections");
        getFreeConnections.setAccessible(true);
        TransferQueue<ConnectionHandle> connections = (TransferQueue<ConnectionHandle>) getFreeConnections.invoke(partition);
        if (!(connections instanceof TransferQueueWithBlockingOperationHook)) {
          synchronized (partition) {
            connections = (TransferQueue<ConnectionHandle>) getFreeConnections.invoke(partition);
            if (!(connections instanceof TransferQueueWithBlockingOperationHook)) {
              final Method setFreeConnections = partition.getClass().getDeclaredMethod("setFreeConnections", TransferQueue.class);
              setFreeConnections.setAccessible(true);
              setFreeConnections.invoke(partition, new TransferQueueWithBlockingOperationHook<ConnectionHandle>(connections));
            }
          }
        }
View Full Code Here

TOP

Related Classes of com.jolbox.bonecp.ConnectionPartition

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.