亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? simpledatasource.java

?? 本套系統采用了業界當前最為流行的beanAction組件
?? JAVA
?? 第 1 頁 / 共 3 頁
字號:
   */
  public long getAverageRequestTime() {
    synchronized (POOL_LOCK) {
      return requestCount == 0 ? 0 : accumulatedRequestTime / requestCount;
    }
  }

  /**
   * Getter for the average time spent waiting for connections that were in use
   * @return The average time
   */
  public long getAverageWaitTime() {
    synchronized (POOL_LOCK) {
      return hadToWaitCount == 0 ? 0 : accumulatedWaitTime / hadToWaitCount;
    }
  }

  /**
   * Getter for the number of requests that had to wait for connections that were in use
   * @return The number of requests that had to wait
   */
  public long getHadToWaitCount() {
    synchronized (POOL_LOCK) {
      return hadToWaitCount;
    }
  }

  /**
   * Getter for the number of invalid connections that were found in the pool
   * @return The number of invalid connections
   */
  public long getBadConnectionCount() {
    synchronized (POOL_LOCK) {
      return badConnectionCount;
    }
  }

  /**
   * Getter for the number of connections that were claimed before they were returned
   * @return The number of connections
   */
  public long getClaimedOverdueConnectionCount() {
    synchronized (POOL_LOCK) {
      return claimedOverdueConnectionCount;
    }
  }

  /**
   * Getter for the average age of overdue connections
   * @return The average age
   */
  public long getAverageOverdueCheckoutTime() {
    synchronized (POOL_LOCK) {
      return claimedOverdueConnectionCount == 0 ? 0 : accumulatedCheckoutTimeOfOverdueConnections / claimedOverdueConnectionCount;
    }
  }


  /**
   * Getter for the average age of a connection checkout
   * @return The average age
   */
  public long getAverageCheckoutTime() {
    synchronized (POOL_LOCK) {
      return requestCount == 0 ? 0 : accumulatedCheckoutTime / requestCount;
    }
  }

  /**
   * Returns the status of the connection pool
   * @return The status
   */
  public String getStatus() {
    StringBuffer buffer = new StringBuffer();

    buffer.append("\n===============================================================");
    buffer.append("\n jdbcDriver                     ").append(jdbcDriver);
    buffer.append("\n jdbcUrl                        ").append(jdbcUrl);
    buffer.append("\n jdbcUsername                   ").append(jdbcUsername);
    buffer.append("\n jdbcPassword                   ").append((jdbcPassword == null ? "NULL" : "************"));
    buffer.append("\n poolMaxActiveConnections       ").append(poolMaximumActiveConnections);
    buffer.append("\n poolMaxIdleConnections         ").append(poolMaximumIdleConnections);
    buffer.append("\n poolMaxCheckoutTime            " + poolMaximumCheckoutTime);
    buffer.append("\n poolTimeToWait                 " + poolTimeToWait);
    buffer.append("\n poolPingEnabled                " + poolPingEnabled);
    buffer.append("\n poolPingQuery                  " + poolPingQuery);
    buffer.append("\n poolPingConnectionsOlderThan   " + poolPingConnectionsOlderThan);
    buffer.append("\n poolPingConnectionsNotUsedFor  " + poolPingConnectionsNotUsedFor);
    buffer.append("\n --------------------------------------------------------------");
    buffer.append("\n activeConnections              " + activeConnections.size());
    buffer.append("\n idleConnections                " + idleConnections.size());
    buffer.append("\n requestCount                   " + getRequestCount());
    buffer.append("\n averageRequestTime             " + getAverageRequestTime());
    buffer.append("\n averageCheckoutTime            " + getAverageCheckoutTime());
    buffer.append("\n claimedOverdue                 " + getClaimedOverdueConnectionCount());
    buffer.append("\n averageOverdueCheckoutTime     " + getAverageOverdueCheckoutTime());
    buffer.append("\n hadToWait                      " + getHadToWaitCount());
    buffer.append("\n averageWaitTime                " + getAverageWaitTime());
    buffer.append("\n badConnectionCount             " + getBadConnectionCount());
    buffer.append("\n===============================================================");
    return buffer.toString();
  }

  /**
   * Closes all of the connections in the pool
   */
  public void forceCloseAll() {
    synchronized (POOL_LOCK) {
      for (int i = activeConnections.size(); i > 0; i--) {
        try {
          SimplePooledConnection conn = (SimplePooledConnection) activeConnections.remove(i - 1);
          conn.invalidate();

          Connection realConn = conn.getRealConnection();
          if (!realConn.getAutoCommit()) {
            realConn.rollback();
          }
          realConn.close();
        } catch (Exception e) {
          // ignore
        }
      }
      for (int i = idleConnections.size(); i > 0; i--) {
        try {
          SimplePooledConnection conn = (SimplePooledConnection) idleConnections.remove(i - 1);
          conn.invalidate();

          Connection realConn = conn.getRealConnection();
          if (!realConn.getAutoCommit()) {
            realConn.rollback();
          }
          realConn.close();
        } catch (Exception e) {
          // ignore
        }
      }
    }
    if (log.isDebugEnabled()) {
      log.debug("SimpleDataSource forcefully closed/removed all connections.");
    }
  }

  private void pushConnection(SimplePooledConnection conn)
      throws SQLException {

    synchronized (POOL_LOCK) {
      activeConnections.remove(conn);
      if (conn.isValid()) {
        if (idleConnections.size() < poolMaximumIdleConnections && conn.getConnectionTypeCode() == getExpectedConnectionTypeCode()) {
          accumulatedCheckoutTime += conn.getCheckoutTime();
          if (!conn.getRealConnection().getAutoCommit()) {
            conn.getRealConnection().rollback();
          }
          SimplePooledConnection newConn = new SimplePooledConnection(conn.getRealConnection(), this);
          idleConnections.add(newConn);
          newConn.setCreatedTimestamp(conn.getCreatedTimestamp());
          newConn.setLastUsedTimestamp(conn.getLastUsedTimestamp());
          conn.invalidate();
          if (log.isDebugEnabled()) {
            log.debug("Returned connection " + newConn.getRealHashCode() + " to pool.");
          }
          POOL_LOCK.notifyAll();
        } else {
          accumulatedCheckoutTime += conn.getCheckoutTime();
          if (!conn.getRealConnection().getAutoCommit()) {
            conn.getRealConnection().rollback();
          }
          conn.getRealConnection().close();
          if (log.isDebugEnabled()) {
            log.debug("Closed connection " + conn.getRealHashCode() + ".");
          }
          conn.invalidate();
        }
      } else {
        if (log.isDebugEnabled()) {
          log.debug("A bad connection (" + conn.getRealHashCode() + ") attempted to return to the pool, discarding connection.");
        }
        badConnectionCount++;
      }
    }
  }

  private SimplePooledConnection popConnection(String username, String password)
      throws SQLException {
    boolean countedWait = false;
    SimplePooledConnection conn = null;
    long t = System.currentTimeMillis();
    int localBadConnectionCount = 0;

    while (conn == null) {
      synchronized (POOL_LOCK) {
        if (idleConnections.size() > 0) {
          // Pool has available connection
          conn = (SimplePooledConnection) idleConnections.remove(0);
          if (log.isDebugEnabled()) {
            log.debug("Checked out connection " + conn.getRealHashCode() + " from pool.");
          }
        } else {
          // Pool does not have available connection
          if (activeConnections.size() < poolMaximumActiveConnections) {
            // Can create new connection
            if (useDriverProps) {
              conn = new SimplePooledConnection(DriverManager.getConnection(jdbcUrl, driverProps), this);
            } else {
              conn = new SimplePooledConnection(DriverManager.getConnection(jdbcUrl, jdbcUsername, jdbcPassword), this);
            }
            Connection realConn = conn.getRealConnection();
            if (realConn.getAutoCommit() != jdbcDefaultAutoCommit) {
              realConn.setAutoCommit(jdbcDefaultAutoCommit);
            }
            if (log.isDebugEnabled()) {
              log.debug("Created connection " + conn.getRealHashCode() + ".");
            }
          } else {
            // Cannot create new connection
            SimplePooledConnection oldestActiveConnection = (SimplePooledConnection) activeConnections.get(0);
            long longestCheckoutTime = oldestActiveConnection.getCheckoutTime();
            if (longestCheckoutTime > poolMaximumCheckoutTime) {
              // Can claim overdue connection
              claimedOverdueConnectionCount++;
              accumulatedCheckoutTimeOfOverdueConnections += longestCheckoutTime;
              accumulatedCheckoutTime += longestCheckoutTime;
              activeConnections.remove(oldestActiveConnection);
              if (!oldestActiveConnection.getRealConnection().getAutoCommit()) {
                oldestActiveConnection.getRealConnection().rollback();
              }
              conn = new SimplePooledConnection(oldestActiveConnection.getRealConnection(), this);
              oldestActiveConnection.invalidate();
              if (log.isDebugEnabled()) {
                log.debug("Claimed overdue connection " + conn.getRealHashCode() + ".");
              }
            } else {
              // Must wait
              try {
                if (!countedWait) {
                  hadToWaitCount++;
                  countedWait = true;
                }
                if (log.isDebugEnabled()) {
                  log.debug("Waiting as long as " + poolTimeToWait + " milliseconds for connection.");
                }
                long wt = System.currentTimeMillis();
                POOL_LOCK.wait(poolTimeToWait);
                accumulatedWaitTime += System.currentTimeMillis() - wt;
              } catch (InterruptedException e) {
                break;
              }
            }
          }
        }
        if (conn != null) {
          if (conn.isValid()) {
            if (!conn.getRealConnection().getAutoCommit()) {
              conn.getRealConnection().rollback();
            }
            conn.setConnectionTypeCode(assembleConnectionTypeCode(jdbcUrl, username, password));
            conn.setCheckoutTimestamp(System.currentTimeMillis());
            conn.setLastUsedTimestamp(System.currentTimeMillis());
            activeConnections.add(conn);
            requestCount++;
            accumulatedRequestTime += System.currentTimeMillis() - t;
          } else {
            if (log.isDebugEnabled()) {
              log.debug("A bad connection (" + conn.getRealHashCode() + ") was returned from the pool, getting another connection.");
            }
            badConnectionCount++;
            localBadConnectionCount++;
            conn = null;
            if (localBadConnectionCount > (poolMaximumIdleConnections + 3)) {
              if (log.isDebugEnabled()) {
                log.debug("SimpleDataSource: Could not get a good connection to the database.");
              }
              throw new SQLException("SimpleDataSource: Could not get a good connection to the database.");
            }
          }
        }
      }

    }

    if (conn == null) {
      if (log.isDebugEnabled()) {
        log.debug("SimpleDataSource: Unknown severe error condition.  The connection pool returned a null connection.");
      }
      throw new SQLException("SimpleDataSource: Unknown severe error condition.  The connection pool returned a null connection.");
    }

    return conn;
  }

  /**
   * Method to check to see if a connection is still usable
   *
   * @param conn - the connection to check
   * @return True if the connection is still usable
   */
  private boolean pingConnection(SimplePooledConnection conn) {
    boolean result = true;

    try {
      result = !conn.getRealConnection().isClosed();
    } catch (SQLException e) {
      if (log.isDebugEnabled()) {
        log.debug("Connection " + conn.getRealHashCode() + " is BAD: " + e.getMessage());
      }    	
      result = false;
    }

    if (result) {
      if (poolPingEnabled) {
        if ((poolPingConnectionsOlderThan > 0 && conn.getAge() > poolPingConnectionsOlderThan)
            || (poolPingConnectionsNotUsedFor > 0 && conn.getTimeElapsedSinceLastUse() > poolPingConnectionsNotUsedFor)) {

          try {
            if (log.isDebugEnabled()) {
              log.debug("Testing connection " + conn.getRealHashCode() + " ...");
            }
            Connection realConn = conn.getRealConnection();
            Statement statement = realConn.createStatement();
            ResultSet rs = statement.executeQuery(poolPingQuery);
            rs.close();
            statement.close();
            if (!realConn.getAutoCommit()) {
              realConn.rollback();
            }
            result = true;
            if (log.isDebugEnabled()) {
              log.debug("Connection " + conn.getRealHashCode() + " is GOOD!");
            }
          } catch (Exception e) {
            log.warn("Execution of ping query '" + poolPingQuery + "' failed: " + e.getMessage());          	
            try {
              conn.getRealConnection().close();
            } catch (Exception e2) {
              //ignore
            }
            result = false;
            if (log.isDebugEnabled()) {
              log.debug("Connection " + conn.getRealHashCode() + " is BAD: " + e.getMessage());
            }
          }
        }
      }
    }
    return result;
  }

  /**
   * Unwraps a pooled connection to get to the 'real' connection
   *
   * @param conn - the pooled connection to unwrap
   * @return The 'real' connection
   */
  public static Connection unwrapConnection(Connection conn) {
    if (conn instanceof SimplePooledConnection) {
      return ((SimplePooledConnection) conn).getRealConnection();
    } else {
      return conn;
    }
  }

  protected void finalize() throws Throwable {
    forceCloseAll();
  }

  /**
   * ---------------------------------------------------------------------------------------
   * SimplePooledConnection
   * ---------------------------------------------------------------------------------------
   */
  private static class SimplePooledConnection implements InvocationHandler {

    private static final String CLOSE = "close";
    private static final Class[] IFACES = new Class[]{Connection.class};

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日一区二区三区| 国产欧美日韩三区| 欧美xxx久久| 日本一区二区免费在线观看视频 | 亚洲午夜激情av| 日本成人在线一区| 成人性生交大片免费看中文| 欧美伊人久久久久久久久影院 | 日本三级亚洲精品| 国产二区国产一区在线观看 | 蜜桃视频在线观看一区| 国产成人av电影| 欧美日韩在线直播| 国产亚洲欧美日韩日本| 亚洲高清免费观看高清完整版在线观看| 免费看欧美女人艹b| 成人av资源在线| 91麻豆精品91久久久久久清纯| 国产喷白浆一区二区三区| 亚洲成av人影院| 成人免费视频国产在线观看| 欧美一区二区人人喊爽| 亚洲日穴在线视频| 韩国女主播成人在线| 色哦色哦哦色天天综合| 久久一区二区视频| 亚洲国产一区视频| 99久久99精品久久久久久 | 国产成人精品一区二| 欧美欧美欧美欧美首页| 成人欧美一区二区三区小说 | 日韩免费电影一区| 亚洲激情图片一区| 国产传媒久久文化传媒| 日韩欧美一区二区不卡| 亚洲一区二区欧美激情| 成人动漫一区二区在线| 久久中文娱乐网| 天堂精品中文字幕在线| 一本大道久久a久久综合| 久久综合色之久久综合| 秋霞午夜鲁丝一区二区老狼| 在线视频你懂得一区| 欧美激情一二三区| 狠狠色狠狠色合久久伊人| 欧美日韩一级黄| 亚洲精品中文字幕乱码三区 | 一区二区三区日韩欧美精品| 国产成人久久精品77777最新版本| 欧美一区二区三区免费大片| 一区二区三区av电影| k8久久久一区二区三区 | 国产a视频精品免费观看| 欧美α欧美αv大片| 日韩高清欧美激情| 欧美日韩在线电影| 一区二区三区在线免费视频| 99精品桃花视频在线观看| 欧美激情一区二区三区四区| 国产精品中文字幕一区二区三区| 欧美一级片在线观看| 日韩高清不卡一区二区| 欧美色电影在线| 亚洲图片欧美视频| 欧美亚洲国产一区在线观看网站| 亚洲伦在线观看| 91麻豆swag| 亚洲欧美另类小说视频| 94色蜜桃网一区二区三区| 国产精品久久久久久久久动漫| 国产aⅴ综合色| 国产日产精品一区| www.久久久久久久久| 亚洲日本在线视频观看| 色又黄又爽网站www久久| 一区二区三区久久| 欧美日韩午夜在线| 日韩中文字幕91| 欧美一区二区三区四区久久| 麻豆精品精品国产自在97香蕉| 精品人在线二区三区| 美女看a上一区| 久久综合久久久久88| 国产一区二区三区电影在线观看 | 不卡欧美aaaaa| 国产精品日韩精品欧美在线| 91在线视频官网| 亚洲国产欧美在线人成| 91精品午夜视频| 国内偷窥港台综合视频在线播放| 久久久久久日产精品| bt欧美亚洲午夜电影天堂| 一区二区三区日本| 欧美一级国产精品| 国产精品99久久久| 亚洲精选视频免费看| 欧美麻豆精品久久久久久| 蜜臀av一区二区在线免费观看| 久久人人超碰精品| 色综合婷婷久久| 日韩精品一二三区| 国产视频不卡一区| 欧洲精品一区二区| 免费观看成人av| 国产精品麻豆欧美日韩ww| 欧美中文字幕一二三区视频| 日韩高清一区二区| 日本一区二区三级电影在线观看| 日本韩国欧美在线| 久久成人免费网| 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆| 91久久精品一区二区三区| 男女视频一区二区| 国产精品国产三级国产aⅴ入口 | 午夜精品久久久久久久99樱桃| 精品国产三级电影在线观看| www.欧美.com| 免费xxxx性欧美18vr| 国产精品美女久久久久av爽李琼| 欧美视频一区二区三区在线观看| 国产一区二区在线看| 一区二区三区在线观看国产| 久久综合色婷婷| 欧美日韩视频第一区| 国产黄色91视频| 亚洲bt欧美bt精品| 欧美国产欧美综合| 91精品国产高清一区二区三区蜜臀| 成人性色生活片免费看爆迷你毛片| 亚洲成人av电影在线| 国产精品三级av在线播放| 欧美一级理论性理论a| 99re这里只有精品视频首页| 麻豆freexxxx性91精品| 一区二区在线观看不卡| 国产三级一区二区三区| 在线不卡免费av| 91美女精品福利| 国产精品1区2区3区在线观看| 天天综合天天综合色| 亚洲视频你懂的| 国产欧美精品区一区二区三区| 日韩一区二区麻豆国产| 91蜜桃在线观看| 国产成人精品一区二区三区网站观看| 日韩电影一区二区三区| 亚洲欧美日本韩国| 欧美国产日韩精品免费观看| 日韩免费电影一区| 91精品午夜视频| 日本精品一级二级| 99久久婷婷国产| 国产在线不卡一区| 蜜臂av日日欢夜夜爽一区| 亚洲福利视频导航| 亚洲综合一区二区| 中文字幕一区二区不卡| 久久久国产综合精品女国产盗摄| 欧美一区二区免费视频| 欧美美女直播网站| 欧美专区日韩专区| 色又黄又爽网站www久久| 成人污视频在线观看| 国产精品中文字幕欧美| 国产美女一区二区三区| 久久精品99国产精品日本| 视频一区二区国产| 亚洲国产cao| 亚洲国产欧美一区二区三区丁香婷| 最新高清无码专区| 亚洲人成网站精品片在线观看| 中文幕一区二区三区久久蜜桃| 国产午夜精品在线观看| 久久夜色精品国产噜噜av | 极品瑜伽女神91| 美女网站色91| 久久99精品国产麻豆婷婷| 秋霞午夜鲁丝一区二区老狼| 蜜桃在线一区二区三区| 久久99久久99小草精品免视看| 免费在线视频一区| 青草国产精品久久久久久| 蜜桃视频一区二区三区| 久久国产精品色| 国产一区二区剧情av在线| 国产成人精品亚洲午夜麻豆| 国产麻豆精品一区二区| 岛国av在线一区| 91在线观看免费视频| 色婷婷国产精品综合在线观看| 日本韩国一区二区三区视频| 精品视频1区2区| 欧美一级片在线观看| 26uuu久久天堂性欧美| 国产丝袜美腿一区二区三区| 中文字幕中文字幕中文字幕亚洲无线| 亚洲色图都市小说| 亚洲福利视频一区| 免费观看成人鲁鲁鲁鲁鲁视频| 国内外精品视频|