/** * '$RCSfile$' * Purpose: A class to test how many sql command one connection can execute * Copyright: 2000 Regents of the University of California and the * National Center for Ecological Analysis and Synthesis * Authors: Jing Tao * * '$Author: leinfelder $' * '$Date: 2011-11-03 03:40:12 +0000 (Thu, 03 Nov 2011) $' * '$Revision: 6595 $' * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import java.io.*; import java.util.Vector; import java.lang.*; import java.sql.*; import edu.ucsb.nceas.metacat.*; import edu.ucsb.nceas.metacat.database.*; /** * A class to test when mamimum dbconnection number reached */ public class MaxmumDBConnection implements Runnable { /** * Usage: java -cp metacat.jar < -t times> * */ public static void main(String [] args) throws Exception { // defaul loop value is 10 int loop = 10; Thread runner = null; DBConnectionPool pool = DBConnectionPool.getInstance(); // get loop number from argument for ( int i=0 ; i < args.length; ++i ) { if ( args[i].equals( "-t" ) ) { loop = Integer.parseInt(args[++i]); }//if else { System.err.println(" args[" +i+ "] '" +args[i]+ "' ignored." ); }//else }//for System.out.println("loop: "+loop); //ran the number of thread. for (int i= 0; i