code: public WorkspaceStorageConnection reuseConnection(WorkspaceStorageConnection original) throws RepositoryException
     {
        if (original instanceof StatisticsJDBCStorageConnection)
        {
           original = ((StatisticsJDBCStorageConnection)original).getNestedWorkspaceStorageConnection();
        }
  
        if (original instanceof JDBCStorageConnection)
        {
           final JDBCStorageConnection storageConnection = (JDBCStorageConnection)original;
           final Connection connection = storageConnection.getJdbcConnection();
           storageConnection.share();
           final Connection proxyConnection =
              (Connection)Proxy.newProxyInstance(GenericConnectionFactory.class.getClassLoader(),
                 new Class[]{Connection.class}, new InvocationHandler()
                 {
                    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
                    {
                       if ("close".equals(method.getName()) && storageConnection.release() > 0)
                       {
                          // We don't close the connection as long as it is used
                          return null;
                       }
                       else if (("commit".equals(method.getName()) || "rollback".equals(method.getName()))
                          && storageConnection.getDbConnectionTotalUsed() > 1)
                       {
                          // We don't commit or roll back as long as it is used
                          return null;
                       }
                       return method.invoke(connection, args);
                    }
                 });
           GenericConnectionFactory cFactory =
              connFactory.cloneWith((DataSource)Proxy.newProxyInstance(GenericConnectionFactory.class.getClassLoader(),
                 new Class[]{DataSource.class}, new InvocationHandler()
                 {
                    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
                    {
                       if ("getConnection".equals(method.getName()))
                       {
                          return proxyConnection;
                       }
                       return method.invoke(getDataSource(), args);
                    }
                 }));
  
           return STATISTICS_ENABLED ? new StatisticsJDBCStorageConnection(cFactory.openConnection(false)) : cFactory
              .openConnection(false);
        }
        else
        {
           return openConnection(false);
        }
     }
docs: {@inheritDoc}