tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@apache.org
Subject svn commit: r380998 - in /tomcat/sandbox: bin/ java/org/apache/tomcat/standalone/ java/org/apache/tomcat/util/net/ js-bin/ webapps/
Date Sat, 25 Feb 2006 21:35:17 GMT
Author: costin
Date: Sat Feb 25 13:35:16 2006
New Revision: 380998

URL: http://svn.apache.org/viewcvs?rev=380998&view=rev
Log:
Few adjustments

Added:
    tomcat/sandbox/java/org/apache/tomcat/standalone/SingleMain.java
    tomcat/sandbox/js-bin/
    tomcat/sandbox/webapps/
Modified:
    tomcat/sandbox/bin/jam_tomcat.sh
    tomcat/sandbox/java/org/apache/tomcat/standalone/Main.java
    tomcat/sandbox/java/org/apache/tomcat/standalone/WebappsMain.java
    tomcat/sandbox/java/org/apache/tomcat/util/net/PoolTcpEndpoint.java
    tomcat/sandbox/java/org/apache/tomcat/util/net/SimpleEndpoint.java

Modified: tomcat/sandbox/bin/jam_tomcat.sh
URL: http://svn.apache.org/viewcvs/tomcat/sandbox/bin/jam_tomcat.sh?rev=380998&r1=380997&r2=380998&view=diff
==============================================================================
--- tomcat/sandbox/bin/jam_tomcat.sh (original)
+++ tomcat/sandbox/bin/jam_tomcat.sh Sat Feb 25 13:35:16 2006
@@ -1,3 +1,4 @@
+#!/bin/sh 
 
-BASE=..
-jamvm -Xms32M -cp $BASE/runtime/tomcat-all-runtime.jar:$BASE/repository/mx4j-3.0.1/lib/mx4j.jar
org.apache.catalina.startup.Bootstrap start
+BASE=`pwd`/..
+jamvm -Xms32M -cp $BASE/sandbox/runtime/tomcat-runtime.jar:$BASE/repository/mx4j-3.0.1/lib/mx4j.jar
org.apache.tomcat.standalone.Main $*

Modified: tomcat/sandbox/java/org/apache/tomcat/standalone/Main.java
URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/standalone/Main.java?rev=380998&r1=380997&r2=380998&view=diff
==============================================================================
--- tomcat/sandbox/java/org/apache/tomcat/standalone/Main.java (original)
+++ tomcat/sandbox/java/org/apache/tomcat/standalone/Main.java Sat Feb 25 13:35:16 2006
@@ -31,14 +31,19 @@
             return;
         }
         String dispatch = args[0];
+        // default: use conf/, server.xml, etc
         String launcher = "org.apache.catalina.startup.Bootstrap";
         if( "-webapps".equals(dispatch) ) {
+            // webapps dir, autodeploy
             launcher = "org.apache.tomcat.standalone.WebappsMain";
-        } else if("-app".equals(dispatch)) {
-            launcher = "org.apache.tomcat.standalone.SimpleAppsMain";            
+        } else if("-single".equals(dispatch)) {
+            // one webapp, using web.xml
+            launcher = "org.apache.tomcat.standalone.SingleMain";            
         } else if("-etomcat".equals(dispatch)) {
+            // explicit control, no XML
             launcher = "org.apache.tomcat.standalone.ETomcat";            
         } else if("-coyote".equals(dispatch)) {
+            // only http11, no servlets
             launcher = "org.apache.coyote.standalone.Main";            
         }
         try {

Added: tomcat/sandbox/java/org/apache/tomcat/standalone/SingleMain.java
URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/standalone/SingleMain.java?rev=380998&view=auto
==============================================================================
--- tomcat/sandbox/java/org/apache/tomcat/standalone/SingleMain.java (added)
+++ tomcat/sandbox/java/org/apache/tomcat/standalone/SingleMain.java Sat Feb 25 13:35:16 2006
@@ -0,0 +1,52 @@
+/*
+ */
+package org.apache.tomcat.standalone;
+
+import org.apache.catalina.core.StandardContext;
+import org.apache.catalina.startup.ContextConfig;
+
+/**
+ * Start tomcat using server.xml and web.xml and regular config files 
+ * 
+ * @author Costin Manolache
+ */
+public class SingleMain extends ETomcat {
+
+    public static void main( String args[] ) {
+        try {
+            SingleMain etomcat = new SingleMain();
+            
+            etomcat.initServer(null);
+            etomcat.initConnector(8000);
+
+            // Use this to load indivitdual webapp, without auto-deployment
+            etomcat.initHost("localhost");
+
+            if( args.length < 2 ) {
+                    etomcat.initWebXmlApp("/", "webapps/ROOT");
+            } else {
+                etomcat.initWebapp(args[0], args[1]);
+                etomcat.initWebappDefaults();
+            }
+
+            etomcat.start();
+        } catch (Exception e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
+
+    public StandardContext initWebXmlApp(String path, String dir) {
+        ctx = new StandardContext();
+        ctx.setPath( path );
+        ctx.setDocBase(dir);
+
+        // web.xml reader
+        ContextConfig ctxCfg = new ContextConfig();
+        ctx.addLifecycleListener( ctxCfg );
+        
+        host.addChild(ctx);
+        return ctx;
+    }
+
+}

Modified: tomcat/sandbox/java/org/apache/tomcat/standalone/WebappsMain.java
URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/standalone/WebappsMain.java?rev=380998&r1=380997&r2=380998&view=diff
==============================================================================
--- tomcat/sandbox/java/org/apache/tomcat/standalone/WebappsMain.java (original)
+++ tomcat/sandbox/java/org/apache/tomcat/standalone/WebappsMain.java Sat Feb 25 13:35:16
2006
@@ -6,7 +6,9 @@
 import org.apache.catalina.startup.HostConfig;
 
 /**
- * Start tomcat using server.xml and web.xml and regular config files 
+ * Example of start tomcat using webapps/ dir. No server.xml or other conf/ file
+ * is used - just a single jar and an webapps/ dir ( plus the auto-generated work/
+ * dir ). You can set authentication, etc programmatically. 
  * 
  * @author Costin Manolache
  */

Modified: tomcat/sandbox/java/org/apache/tomcat/util/net/PoolTcpEndpoint.java
URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/net/PoolTcpEndpoint.java?rev=380998&r1=380997&r2=380998&view=diff
==============================================================================
--- tomcat/sandbox/java/org/apache/tomcat/util/net/PoolTcpEndpoint.java (original)
+++ tomcat/sandbox/java/org/apache/tomcat/util/net/PoolTcpEndpoint.java Sat Feb 25 13:35:16
2006
@@ -88,6 +88,8 @@
     protected int maxSpareThreads = 20;
     protected int minSpareThreads = 20;
     protected String type = "default";
+    // to name the threads and get an idea how many threads were closed
+    protected int threadId = 0;
 
     protected String name = "EP"; // base name for threads
     

Modified: tomcat/sandbox/java/org/apache/tomcat/util/net/SimpleEndpoint.java
URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/net/SimpleEndpoint.java?rev=380998&r1=380997&r2=380998&view=diff
==============================================================================
--- tomcat/sandbox/java/org/apache/tomcat/util/net/SimpleEndpoint.java (original)
+++ tomcat/sandbox/java/org/apache/tomcat/util/net/SimpleEndpoint.java Sat Feb 25 13:35:16
2006
@@ -55,7 +55,7 @@
     
     public SimpleEndpoint() {
         maxSpareThreads = 4;
-        minSpareThreads = 1;
+        minSpareThreads = 2;
     }
 
 
@@ -125,7 +125,7 @@
     void newAcceptor() {
         acceptors++;
         Thread t=new ThreadWithAttributes( this, new AcceptorRunnable());
-        t.setName("Tomcat-" + acceptors);
+        t.setName("Tomcat-" + threadId++);
         if( threadPriority > 0 ) {
             t.setPriority(threadPriority);
         }
@@ -335,7 +335,7 @@
             while( running ) {
                 // Loop if endpoint is paused
                 if( checkSpares() ) {
-                    return;
+                    break;
                 }
                 
                 while (paused) {
@@ -357,7 +357,8 @@
                 curThreads--;
                 
                 if( checkSpares() ) {
-                    return;
+                    break;
+                    // return;
                 }
             }
             



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message