JMX监控下的JBoss数据库连接池
来源:优易学  2011-4-28 17:16:57   【优易学:中国教育考试门户网】   资料下载   IT书店

 

  if(i<1) {//监控可用连接数。
  StringBuffer sb=new StringBuffer();
  sb.append("oper before DataSource Pool info : rn");
  sb.append("AvailableConnectionCount="
  + AvailableConnectionCount);
  sb.append("InUseConnectionCount="+InUseConnectionCount);
  sb.append("ConnectionCreatedCount="
  + ConnectionCreatedCount);
  sb.append("ConnectionDestroyedCount="
  + ConnectionDestroyedCount);
  sb.append("rn");
  //opReturn=server.invoke(name,"flush",argTypes,argTypes);
  /*调用mbean的方法释放连接 begin 本实现方法对应jboss3.2.3
  对于jboss4以后的版本只需调用
  //opReturn=server.invoke(name,"flush",argTypes,argTypes);
  **/
  opReturn=server.invoke(name,"stop",argTypes,argTypes);
  opReturn=server.invoke(name,"start",argTypes,argTypes);
  opReturn=server.invoke(lname,"stop",argTypes,argTypes);
  opReturn=server.invoke(lname,"start",argTypes,argTypes);
  /*调用mbean的方法释放连接 end **/
  AvailableConnectionCount=server.getAttribute(name,
  "AvailableConnectionCount").toString();
  InUseConnectionCount=server.getAttribute(name,
  "InUseConnectionCount").toString();
  ConnectionCreatedCount=server.getAttribute(name,
  "ConnectionCreatedCount").toString();
  ConnectionDestroyedCount =server.getAttribute(name,
  "ConnectionDestroyedCount").toString();
  ConnectionDestroyedCount=server.getAttribute(name,
  "ConnectionDestroyedCount").toString();
  sb.append("oper afer DataSource Pool info :rn");
  sb.append("AvailableConnectionCount="
  + AvailableConnectionCount);
  sb.append("InUseConnectionCount="+InUseConnectionCount);
  sb.append("ConnectionCreatedCount="
  + ConnectionCreatedCount);
  sb.append("ConnectionDestroyedCount="
  + ConnectionDestroyedCount);
  //writeLog(sb.toString()); 操作日志信息
  System.out.println("===========op SUCCESS============");
  }
  }catch(Exception ex){
  ex.printStackTrace();
  }
  }
  }

上一页  [1] [2] 

责任编辑:小草

文章搜索:
 相关文章
热点资讯
资讯快报
热门课程培训