Examples of ConnectionPool


Examples of org.apache.tomcat.jdbc.pool.ConnectionPool

    return dataSource.getPool();
  }

  @Override
  public void addMetrics(MetricTreeObject tree) {
    ConnectionPool pool = getPool();
    if (pool == null) {
      // TODO: Should we handle this properly??
      return;
    }

    MetricTreeObject subtree = tree.getSubtree(key);

    // Statistics stats = pool.getStatistics();
    // subtree.addInt("hitCount", stats.getCacheHits());
    // subtree.addInt("missCount", stats.getCacheMiss());
    // subtree.addInt("connectionsRequested", stats.getConnectionsRequested());
    // subtree.addInt("statementsCached", stats.getStatementsCached());
    // subtree.addInt("statementsExecuted", stats.getStatementsExecuted());
    // subtree.addInt("statementsPrepared", stats.getStatementsPrepared());
    // subtree.addInt("cumulativeConnectionWaitTime", stats.getCumulativeConnectionWaitTime());
    // subtree.addInt("cumulativeStatementExecutionTime", stats.getCumulativeStatementExecutionTime());
    // subtree.addInt("cumulativeStatementPrepareTime", stats.getCumulativeStatementPrepareTime());
    //
    subtree.addInt("activeConnections", pool.getActive());
    subtree.addInt("idleConnections", pool.getIdle());
    subtree.addInt("waitCount", pool.getWaitCount());

  }
View Full Code Here

Examples of org.apache.tomcat.jdbc.pool.ConnectionPool

            ResultSet rs = st.executeQuery();
            rs.close();
            st.close();
        }
        System.out.println("Stats:"+stats);
        ConnectionPool pool = datasource.getPool();
        con.close();
        tearDown();
        //make sure we actually did clean up when the pool closed
        assertNull(SlowQueryReport.getPoolStats(pool.getName()));
    }
View Full Code Here

Examples of org.apache.tomcat.jdbc.pool.ConnectionPool

        assertEquals(1,map.size());
        String key = map.keySet().iterator().next();
        SlowQueryReport.QueryStats stats = map.get(key);
        System.out.println("Stats:"+stats);
        ClientListener listener = new ClientListener();
        ConnectionPool pool = datasource.getPool();
        ManagementFactory.getPlatformMBeanServer().addNotificationListener(
                SlowQueryReportJmx.getObjectName(SlowQueryReportJmx.class, pool.getName()),
                listener,
                null,
                null);
       
        for (int i=0; i<count; i++) {
            PreparedStatement st = con.prepareStatement(slowSql);
            ResultSet rs = st.executeQuery();
            rs.close();
            st.close();
        }
        System.out.println("Stats:"+stats);
       
        for (int i=0; i<count; i++) {
            CallableStatement st = con.prepareCall(slowSql);
            ResultSet rs = st.executeQuery();
            rs.close();
            st.close();
        }
        System.out.println("Stats:"+stats);
        assertEquals("Expecting to have received "+(2*count)+" notifications.",2*count, listener.notificationCount);
        con.close();
        tearDown();
        //make sure we actually did clean up when the pool closed
        assertNull(SlowQueryReport.getPoolStats(pool.getName()));
    }
View Full Code Here

Examples of org.apache.tomcat.jdbc.pool.ConnectionPool

            st.close();
        }
        Map<String,SlowQueryReport.QueryStats> map = SlowQueryReport.getPoolStats(datasource.getPool().getName());
        assertNotNull(map);
        assertEquals(0,map.size());
        ConnectionPool pool = datasource.getPool();
        con.close();
        tearDown();
        assertNull(SlowQueryReport.getPoolStats(pool.getName()));
    }   
View Full Code Here

Examples of org.apache.tomcat.jdbc.pool.ConnectionPool

           
        }
        Map<String,SlowQueryReport.QueryStats> map = SlowQueryReport.getPoolStats(datasource.getPool().getName());
        assertNotNull(map);
        assertEquals(1,map.size());
        ConnectionPool pool = datasource.getPool();
        String key = map.keySet().iterator().next();
        SlowQueryReport.QueryStats stats = map.get(key);
        System.out.println("Stats:"+stats);
        con.close();
        tearDown();
        assertNull(SlowQueryReport.getPoolStats(pool.getName()));
    }  
View Full Code Here

Examples of org.apache.tomcat.jdbc.pool.ConnectionPool

        String domain = "tomcat.jdbc";
        Hashtable<String,String> properties = new Hashtable<String,String>();
        properties.put("type", "ConnectionPool");
        properties.put("class", this.getClass().getName());
        oname = new ObjectName(domain,properties);
        ConnectionPool pool = datasource.createPool();
        org.apache.tomcat.jdbc.pool.jmx.ConnectionPool jmxPool = new org.apache.tomcat.jdbc.pool.jmx.ConnectionPool(pool);
        mbs.registerMBean(jmxPool, oname);
       
    }
View Full Code Here

Examples of org.apache.turbine.util.db.pool.ConnectionPool

                                      String url,
                                      String username,
                                      String password)
        throws Exception
    {
        ConnectionPool pool = null;
        url = url.trim();

        // Quick (non-sync) check for the pool we want.
        // NOTE: Here we must not call getPool(), since the pool
        // is almost certainly not defined in the properties file
        pool = (ConnectionPool) pools.get(url + username);
        if ( pool == null )
        {
            registerPool(url + username, driver,  url, username, password);
            pool = (ConnectionPool) pools.get(url + username);
        }

        return pool.getConnection();
    }
View Full Code Here

Examples of org.eclipse.persistence.sessions.server.ConnectionPool

    * @param poolName the name of the pool to get the max size for
    * @return Integer for the max size of the pool. Return -1 if pool doesn't exist.
    */
    public Integer getMaxSizeForPool(String poolName) {
        if (ClassConstants.ServerSession_Class.isAssignableFrom(getSession().getClass())) {
            ConnectionPool connectionPool = ((ServerSession)getSession()).getConnectionPool(poolName);
            if (connectionPool != null) {
                return new Integer(connectionPool.getMaxNumberOfConnections());
            }
        }
        return new Integer(-1);
    }
View Full Code Here

Examples of org.eclipse.persistence.sessions.server.ConnectionPool

    * @param poolName the name of the pool to get the min size for
    * @return Integer for the min size of the pool. Return -1 if pool doesn't exist.
    */
    public Integer getMinSizeForPool(String poolName) {
        if (ClassConstants.ServerSession_Class.isAssignableFrom(getSession().getClass())) {
            ConnectionPool connectionPool = ((ServerSession)getSession()).getConnectionPool(poolName);
            if (connectionPool != null) {
                return new Integer(connectionPool.getMinNumberOfConnections());
            }
        }
        return new Integer(-1);
    }
View Full Code Here

Examples of org.eclipse.persistence.sessions.server.ConnectionPool

    */
    public synchronized void resetAllConnections() {
        if (ClassConstants.ServerSession_Class.isAssignableFrom(getSession().getClass())) {
            Iterator enumtr = ((ServerSession)getSession()).getConnectionPools().values().iterator();
            while (enumtr.hasNext()) {
                ConnectionPool pool = (ConnectionPool)enumtr.next();
                pool.shutDown();
                pool.startUp();
            }
        } else if (ClassConstants.PublicInterfaceDatabaseSession_Class.isAssignableFrom(getSession().getClass())) {
            getSession().getAccessor().reestablishConnection(getSession());
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.