Return-Path: Delivered-To: apmail-jakarta-tomcat-dev-archive@apache.org Received: (qmail 29511 invoked from network); 9 Aug 2002 20:54:36 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 9 Aug 2002 20:54:36 -0000 Received: (qmail 16491 invoked by uid 97); 9 Aug 2002 20:54:56 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-dev@jakarta.apache.org Received: (qmail 16475 invoked by uid 97); 9 Aug 2002 20:54:56 -0000 Mailing-List: contact tomcat-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Developers List" Reply-To: "Tomcat Developers List" Delivered-To: mailing list tomcat-dev@jakarta.apache.org Received: (qmail 16464 invoked by uid 97); 9 Aug 2002 20:54:55 -0000 X-Antivirus: nagoya (v4198 created Apr 24 2002) Date: 9 Aug 2002 20:54:24 -0000 Message-ID: <20020809205424.49512.qmail@icarus.apache.org> From: costin@apache.org To: jakarta-tomcat-connectors-cvs@apache.org Subject: cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/core JkHandler.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N costin 2002/08/09 13:54:24 Modified: jk/java/org/apache/jk/server JkMain.java jk/java/org/apache/jk/core JkHandler.java Log: More getters and improvements for nice JMX view.. Revision Changes Path 1.29 +56 -9 jakarta-tomcat-connectors/jk/java/org/apache/jk/server/JkMain.java Index: JkMain.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/server/JkMain.java,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- JkMain.java 24 Jul 2002 22:13:06 -0000 1.28 +++ JkMain.java 9 Aug 2002 20:54:23 -0000 1.29 @@ -115,6 +115,7 @@ public JkMain() { + JkMain.jkMain=this; modules.put("channelSocket", "org.apache.jk.common.ChannelSocket"); modules.put("channelUnix", "org.apache.jk.common.ChannelUn"); modules.put("channelJni", "org.apache.jk.common.ChannelJni"); @@ -124,6 +125,11 @@ modules.put("request","org.apache.jk.common.HandlerRequest"); modules.put("container","org.apache.jk.common.HandlerRequest"); } + + public static JkMain getJkMain() { + return jkMain; + } + // -------------------- Setting -------------------- /** Load a .properties file into and set the values @@ -138,6 +144,10 @@ } } + public String getPropertiesFile() { + return propFile; + } + /** Set a name/value as a jk2 property */ public void setProperty( String n, String v ) { @@ -159,6 +169,10 @@ props.put( "handler.channel.className",name); } + public String getChannelClassName() { + return (String)props.get( "handler.channel.className"); + } + /** * Set the workerClassName that will handle the request. * ( sort of 'pivot' in axis :-) @@ -167,6 +181,10 @@ props.put( "handler.container.className",name); } + public String getWorkerClassName() { + return (String)props.get( "handler.container.className"); + } + /** Set the base dir of jk2. ( including WEB-INF if in a webapp ). * We'll try to guess it from classpath if none is set ( for * example on command line ), but if in a servlet environment @@ -176,22 +194,36 @@ public void setJkHome( String s ) { wEnv.setJkHome(s); } + + public String getJkHome() { + return wEnv.getJkHome(); + } String out; String err; + File propsF; public void setOut( String s ) { this.out=s; } + public String getOut() { + return this.out; + } + public void setErr( String s ) { this.err=s; } + public String getErr() { + return this.err; + } + // -------------------- Initialization -------------------- public void init() throws IOException { + long t1=System.currentTimeMillis(); if(null != out) { PrintStream outS=new PrintStream(new FileOutputStream(out)); System.setOut(outS); @@ -215,17 +247,19 @@ if( ! conf.exists() ) conf=new File( home, "etc" ); - File propsF=new File( conf, "jk2.properties" ); + propsF=new File( conf, "jk2.properties" ); if( propsF.exists() ) { - log.info("Starting Jk2, base dir= " + home + " conf=" + propsF ); + log.debug("Starting Jk2, base dir= " + home + " conf=" + propsF ); setPropertiesFile( propsF.getAbsolutePath()); } else { - log.info("Starting Jk2, base dir= " + home ); + log.debug("Starting Jk2, base dir= " + home ); if( log.isWarnEnabled() ) log.warn( "No properties file found " + propsF ); } } + long t2=System.currentTimeMillis(); + initTime=t2-t1; } static String defaultHandlers[]= { "request", @@ -258,6 +292,7 @@ public void start() throws IOException { + long t1=System.currentTimeMillis(); // We must have at least 3 handlers: // channel is the 'transport' // request is the request processor or 'global' chain @@ -300,10 +335,12 @@ } started=true; - long initTime=System.currentTimeMillis() - start_time; + long t2=System.currentTimeMillis(); + startTime=t2-t1; this.saveProperties(); - log.info("Jk running ID=" + wEnv.getLocalId() + " ... init time=" + initTime + " ms"); + log.info("Jk running ID=" + wEnv.getLocalId() + " time=" + initTime + "/" + startTime + + " config=" + propFile); } // -------------------- Usefull methods -------------------- @@ -339,14 +376,24 @@ } + /** The time it took to initialize jk ( ms) + */ + public long getInitTime() { + return initTime; + } + + /** The time it took to start jk ( ms ) + */ public long getStartTime() { - return start_time; + return startTime; } // -------------------- Main -------------------- - static long start_time=System.currentTimeMillis(); - + long initTime; + long startTime; + static JkMain jkMain=null; + public static void main(String args[]) { try { if( args.length == 1 && @@ -360,7 +407,7 @@ return; } - JkMain jkMain=new JkMain(); + jkMain=new JkMain(); IntrospectionUtils.processArgs( jkMain, args, new String[] {}, null, new Hashtable()); 1.9 +12 -0 jakarta-tomcat-connectors/jk/java/org/apache/jk/core/JkHandler.java Index: JkHandler.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/core/JkHandler.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- JkHandler.java 5 Jun 2002 21:23:32 -0000 1.8 +++ JkHandler.java 9 Aug 2002 20:54:24 -0000 1.9 @@ -111,6 +111,10 @@ this.id=id; } + public int getId() { + return id; + } + /** Catalina-style "recursive" invocation. * A chain is used for Apache/3.3 style iterative invocation. */ @@ -120,6 +124,14 @@ public void setNext( String s ) { nextName=s; + } + + public String getNext() { + if( nextName==null ) { + if( next!=null) + nextName=next.getName(); + } + return nextName; } /** Should register the request types it can handle, -- To unsubscribe, e-mail: For additional commands, e-mail: