code: public Connection getConnection() throws SQLException { 
      	MicroPooledConnection microConn=null;
  		String xGroupId=getXGroupIdByLocal();
  		String xBranchId=getXBranchIdByLocal();
      	if(xGroupId==null || "".equals(xGroupId)){
      		log.error("getConnection error xid is null");
      		throw new RuntimeException("getConnection error xid is null");
      	}
      	Connection conn=getConnByGbId(xGroupId,xBranchId);
  
      	
      	if(conn!=null){
      		log.debug("get conn from holdermap xid="+getStr4XidLocal());
          	if(checkConn(conn)==false){
          		Connection reconn=recreateConn(conn);
          		microConn=new MicroPooledConnection(reconn);
          	}else{
          		microConn=new MicroPooledConnection(conn);
          	}
          	putConnByGbId(xGroupId,xBranchId, microConn);
      		return microConn;
      	}
      	
      	int totalSize=getConnCount();
      	if(totalSize>=maxSize){
      		throw new RuntimeException("getConnection error totalsize > maxsize");
      	}
      	
         // synchronized (pool) { 
  
              if (pool.isEmpty()==false){
              	conn=pool.poll(); 
              	log.debug("get conn from pool xid="+getStr4XidLocal());
              	if(checkConn(conn)==false){
              		Connection reconn=recreateConn(conn);
              		microConn=new MicroPooledConnection(reconn);
              	}else{
              		microConn=new MicroPooledConnection(conn);
              	}
              	
              }else{
              	log.debug("create conn in pool xid="+getStr4XidLocal());
      			Connection nconn=DriverManager.getConnection(url, username, password); 
      			nconn.setAutoCommit(false);
      			nconn.setTransactionIsolation(level);	
      			microConn=new MicroPooledConnection(nconn);
              }
              putConnByGbId(xGroupId,xBranchId, microConn);
        //  } 
          return microConn;
      }
docs: 获取一个数据库连接
  
  @return 一个数据库连接
  @throws SQLException