Examples of SnapshotIF


Examples of org.logicalcobwebs.proxool.admin.SnapshotIF

    @Override
  public String toString() {
        try {
            ConnectionPoolDefinitionIF poolDef = ProxoolFacade.getConnectionPoolDefinition("openfire");
            SnapshotIF poolStats = ProxoolFacade.getSnapshot("openfire", true);
            return poolDef.getMinimumConnectionCount()+","+poolDef.getMaximumConnectionCount()+","
                    +poolStats.getAvailableConnectionCount()+","+poolStats.getActiveConnectionCount();
        }
        catch (ProxoolException e) {
            return "Default Connection Provider";
        }
    }
View Full Code Here

Examples of org.logicalcobwebs.proxool.admin.SnapshotIF

        super(adapter, config, ds);
    }

    public Integer getIdleConnectionCount() {
        try {
            SnapshotIF snapshot = ProxoolFacade.getSnapshot(getConfiguration().getName());
            return snapshot.getAvailableConnectionCount();
        } catch (ProxoolException e) {
            logger.error("", e);
            return null;
        }
    }
View Full Code Here

Examples of org.logicalcobwebs.proxool.admin.SnapshotIF

        }
    }

    public Integer getBusyConnectionCount() {
        try {
            SnapshotIF snapshot = ProxoolFacade.getSnapshot(getConfiguration().getName());
            return snapshot.getActiveConnectionCount();
        } catch (ProxoolException e) {
            logger.error("", e);
            return null;
        }
    }
View Full Code Here

Examples of org.logicalcobwebs.proxool.admin.SnapshotIF

        }
    }

    public Integer getConnectionCount() {
        try {
            SnapshotIF snapshot = ProxoolFacade.getSnapshot(getConfiguration().getName());
            return (int)snapshot.getConnectionCount();
        } catch (ProxoolException e) {
            logger.error("", e);
            return null;
        }
    }
View Full Code Here

Examples of org.logicalcobwebs.proxool.admin.SnapshotIF

            } else {
                break;
            }
        }

        final SnapshotIF snapshot = ProxoolFacade.getSnapshot(alias, true);
        LOG.info("Active count: " + snapshot.getActiveConnectionCount());
        LOG.info("Available count: " + snapshot.getAvailableConnectionCount());
        ConnectionInfoIF[] cis = snapshot.getConnectionInfos();
        LOG.info("Found " + cis.length + " connetions with a detailed snapshot" + "");
        for (int i = 0; i < cis.length; i++) {
            ConnectionInfoIF ci = cis[i];
            LOG.info("#" + ci.getId() + ": " + ci.getStatus() + ", lap=" + (ci.getTimeLastStopActive() - ci.getTimeLastStartActive()));
        }
View Full Code Here

Examples of org.logicalcobwebs.proxool.admin.SnapshotIF

                    Thread.sleep(100);
                } catch (InterruptedException e) {
                    LOG.error("Awoken", e);
                }
                try {
                    SnapshotIF s = ProxoolFacade.getSnapshot(alias, true);
                    int c1 = s.getActiveConnectionCount();
                    int c2 = getCount(s.getConnectionInfos(), ConnectionInfoIF.STATUS_ACTIVE);
                    int v1 = s.getAvailableConnectionCount();
                    int v2 = getCount(s.getConnectionInfos(), ConnectionInfoIF.STATUS_AVAILABLE);
                    int o1 = s.getOfflineConnectionCount();
                    int o2 = getCount(s.getConnectionInfos(), ConnectionInfoIF.STATUS_OFFLINE);
                    if (c1 != c2 || v1 != v2 || o1 != o2) {
                        LOG.error("Disparity noticed. Active: " + c1 + (c1 == c2 ? " == " : " != ") + c2
                            + ", available: " + v1 + (v1 == v2 ? " == " : " != ") + v2
                            + ", offline: " + o1 + (o1 == o2 ? " == " : " != ") + o2);
                        disparityNoticed = true;
View Full Code Here

Examples of org.logicalcobwebs.proxool.admin.SnapshotIF

        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            LOG.debug("Awoken.");
        }
        SnapshotIF snapshot = ProxoolFacade.getSnapshot(alias, false);
        assertEquals("activeConnectionCount", 0, snapshot.getActiveConnectionCount());
        assertEquals("availableConnectionCount", 1, snapshot.getAvailableConnectionCount());
        assertEquals("connectionCount", 1, snapshot.getConnectionCount());

    }
View Full Code Here

Examples of org.logicalcobwebs.proxool.admin.SnapshotIF

            try {
                Thread.sleep(3000);
            } catch (InterruptedException e) {
                LOG.debug("Awoken.");
            }
            SnapshotIF snapshot = ProxoolFacade.getSnapshot(alias, false);
            assertEquals("activeConnectionCount", 0, snapshot.getActiveConnectionCount());
            assertEquals("availableConnectionCount", 0, snapshot.getAvailableConnectionCount());
            assertEquals("connectionCount", 0, snapshot.getConnectionCount());
        } finally {
            // Back to normal
            ConnectionResetter.setTriggerResetException(false);
        }
View Full Code Here

Examples of org.logicalcobwebs.proxool.admin.SnapshotIF

        Connection[] connections = new Connection[6];

        SnapshotResultMonitor srm = new SnapshotResultMonitor(alias) {
            public boolean check(SnapshotIF snapshot) throws Exception {
                SnapshotIF s = ProxoolFacade.getSnapshot(alias);
                return (s.getActiveConnectionCount() == 0
                        && s.getAvailableConnectionCount() >= 2);
            }
        };
        assertEquals("Timeout", ResultMonitor.SUCCESS, srm.getResult());
        assertEquals("activeConnectionCount", 0, srm.getSnapshot().getActiveConnectionCount());
        assertEquals("availableConnectionCount", 2, srm.getSnapshot().getAvailableConnectionCount());

        connections[0] = DriverManager.getConnection(url);

        srm = new SnapshotResultMonitor(alias) {
            public boolean check(SnapshotIF snapshot) throws Exception {
                SnapshotIF s = ProxoolFacade.getSnapshot(alias);
                return (s.getActiveConnectionCount() == 1
                        && s.getAvailableConnectionCount() >= 2);
            }
        };
        assertEquals("Timeout", ResultMonitor.SUCCESS, srm.getResult());
        assertEquals("activeConnectionCount", 1, srm.getSnapshot().getActiveConnectionCount());
        assertEquals("availableConnectionCount", 2, srm.getSnapshot().getAvailableConnectionCount());

        connections[1] = DriverManager.getConnection(url);
        connections[2] = DriverManager.getConnection(url);
        connections[3] = DriverManager.getConnection(url);

        srm = new SnapshotResultMonitor(alias) {
            public boolean check(SnapshotIF snapshot) throws Exception {
                SnapshotIF s = ProxoolFacade.getSnapshot(alias);
                return (s.getActiveConnectionCount() == 4
                        && s.getAvailableConnectionCount() == 1);
            }
        };
        assertEquals("Timeout", ResultMonitor.SUCCESS, srm.getResult());
        assertEquals("activeConnectionCount", 4, srm.getSnapshot().getActiveConnectionCount());
        assertEquals("availableConnectionCount", 1, srm.getSnapshot().getAvailableConnectionCount());
View Full Code Here

Examples of org.logicalcobwebs.proxool.admin.SnapshotIF

        String url = TestHelper.buildProxoolUrl(alias, TestConstants.HYPERSONIC_DRIVER, TestConstants.HYPERSONIC_TEST_URL);
        ProxoolFacade.registerConnectionPool(url, info);

        ResultMonitor srm = new SnapshotResultMonitor(alias) {
            public boolean check(SnapshotIF snapshot) throws Exception {
                SnapshotIF s = ProxoolFacade.getSnapshot(alias);
                return (s.getAvailableConnectionCount() == 2);
            }
        };
        assertEquals("Timeout", ResultMonitor.SUCCESS, srm.getResult());

        assertEquals("availableConnectionCount", 2, ProxoolFacade.getSnapshot(alias, false).getAvailableConnectionCount());
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.