Example usage for javax.sql DataSource getClass

List of usage examples for javax.sql DataSource getClass

Introduction

In this page you can find the example usage for javax.sql DataSource getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:org.yx.db.conn.ConnectionFactory.java

public Map<String, Map<String, Integer>> status() {
    Set<DataSource> set = new HashSet<>();
    set.addAll(this.read.allDataSource());
    set.addAll(this.write.allDataSource());
    Map<String, Map<String, Integer>> statusMap = new HashMap<>();
    for (DataSource datasource : set) {
        if (!BasicDataSource.class.isInstance(datasource)) {
            Log.get(this.getClass(), 25345).info("ds.class({}) is not instance form BasicDataSource",
                    datasource.getClass().getName());
            continue;
        }//from   www  .j ava  2 s. c  om
        @SuppressWarnings("resource")
        BasicDataSource ds = (BasicDataSource) datasource;
        Map<String, Integer> map = new HashMap<>();
        map.put("active", ds.getNumActive());
        map.put("idle", ds.getNumIdle());
        map.put("minIdle", ds.getMinIdle());
        map.put("maxIdle", ds.getMaxIdle());
        map.put("maxTotal", ds.getMaxTotal());
        statusMap.put(ds.toString(), map);
    }
    return statusMap;
}