svn commit: r348967 - /tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaManager.java

2005-11-25 Thread pero
Author: pero
Date: Fri Nov 25 07:38:28 2005
New Revision: 348967

URL: http://svn.apache.org/viewcvs?rev=348967&view=rev
Log:
Fix that log info only construct when level is enabled.

Modified:

tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaManager.java

Modified: 
tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaManager.java
URL: 
http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaManager.java?rev=348967&r1=348966&r2=348967&view=diff
==
--- 
tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaManager.java
 (original)
+++ 
tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaManager.java
 Fri Nov 25 07:38:28 2005
@@ -1509,7 +1509,8 @@
 byte[] delta = msg.getSession();
 DeltaSession session = (DeltaSession) findSession(msg.getSessionID());
 if (session != null) {
-log.debug(sm.getString("deltaManager.receiveMessage.delta",
+if (log.isDebugEnabled())
+log.debug(sm.getString("deltaManager.receiveMessage.delta",
 getName(), msg.getSessionID()));
 DeltaRequest dreq = loadDeltaRequest(session, delta);
 dreq.execute(session, notifyListenersOnReplication);



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r348970 - /tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/LocalStrings.properties

2005-11-25 Thread pero
Author: pero
Date: Fri Nov 25 07:43:37 2005
New Revision: 348970

URL: http://svn.apache.org/viewcvs?rev=348970&view=rev
Log:
Fix some typos

Modified:

tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/LocalStrings.properties

Modified: 
tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/LocalStrings.properties
URL: 
http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/LocalStrings.properties?rev=348970&r1=348969&r2=348970&view=diff
==
--- 
tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/LocalStrings.properties
 (original)
+++ 
tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/LocalStrings.properties
 Fri Nov 25 07:43:37 2005
@@ -1,9 +1,9 @@
 AsyncSocketSender.create.thread=Create sender [{0}:{1,number,integer}] queue 
thread to tcp background replication
 AsyncSocketSender.queue.message=Queue message to [{0}:{1,number,integer}] 
id=[{2}] size={3}
-AsyncSocketSender.send.error=Unable to asynchronously send session w/ id=[{0}] 
message will be ignored.
+AsyncSocketSender.send.error=Unable to asynchronously send session with 
id=[{0}] - message will be ignored.
 AsyncSocketSender.queue.empty=Queue in sender [{0}:{1,number,integer}] 
returned null element!
 cluster.mbean.register.allready=MBean {0} allready registered!
-FastAsyncSocketSender.setThreadPriority=[{0}:{1,number,integer}] 
setPriority({2}) here
+FastAsyncSocketSender.setThreadPriority=[{0}:{1,number,integer}] set priority 
to {2}
 FastAsyncSocketSender.min.exception=[{0}:{1,number,integer}] new priority {2} 
< MIN_PRIORITY
 FastAsyncSocketSender.max.exception=[{0}:{1,number,integer}] new priority {2} 
> MAX_PRIORITY
 IDataSender.ack.eof=EOF reached at local port [{0}:{1,number,integer}]
@@ -23,14 +23,14 @@
 IDataSender.send.again=Send data again to [{0}:{1,number,integer}]
 IDataSender.send.crash=Send message crashed [{0}:{1,number,integer}] 
type=[{2}], id=[{3}]
 IDataSender.send.message=Send message to [{0}:{1,number,integer}] id=[{2}] 
size={3,number,integer}
-IDataSender.send.lost=Send message don't send [{0}:{1,number,integer}] 
type=[{2}], id=[{3}]
+IDataSender.send.lost=Message lost: [{0}:{1,number,integer}] type=[{2}], 
id=[{3}]
 IDataSender.senderModes.Configured=Configured a data replication sender for 
mode {0}
-IDataSender.senderModes.Instantiate=Cannot instantiate a data replication 
sender of class {0}
-IDataSender.senderModes.Missing=Cannot configure a data replication sender for 
mode {0}
-IDataSender.senderModes.Resources=Cannot load data replication sender mapping 
list
-IDataSender.stats=Send stats from [{0}:{1,number,integer}] Nr of bytes 
sent={2,number,integer} over {3} = {4,number,integer} bytes/request, processing 
time {5,number,integer} msec, avg processing time {6,number,integer} msec
+IDataSender.senderModes.Instantiate=Can't instantiate a data replication 
sender of class {0}
+IDataSender.senderModes.Missing=Can't configure a data replication sender for 
mode {0}
+IDataSender.senderModes.Resources=Can't load data replication sender mapping 
list
+IDataSender.stats=Send stats from [{0}:{1,number,integer}], Nr of bytes 
sent={2,number,integer} over {3} = {4,number,integer} bytes/request, processing 
time {5,number,integer} msec, avg processing time {6,number,integer} msec
 PoolSocketSender.senderQueue.sender.failed=PoolSocketSender create new sender 
to [{0}:{1,number,integer}] failed
-PoolSocketSender.noMoreSender=No socket sender available for client 
[{0}:{1,number,integer}] did it disappear?
+PoolSocketSender.noMoreSender=No socket sender available for client 
[{0}:{1,number,integer}] did it disappeared?
 ReplicationTransmitter.getProperty=get property {0}
 ReplicationTransmitter.setProperty=set property {0}: {1} old value {2}
 ReplicationTransmitter.started=Start ClusterSender at cluster {0} with name {1}



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r348972 - in /tomcat/container/tc5.5.x: modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaManager.java webapps/docs/changelog.xml

2005-11-25 Thread pero
Author: pero
Date: Fri Nov 25 07:56:09 2005
New Revision: 348972

URL: http://svn.apache.org/viewcvs?rev=348972&view=rev
Log:
Fix that not usefull log message are generated!

Modified:

tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaManager.java
tomcat/container/tc5.5.x/webapps/docs/changelog.xml

Modified: 
tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaManager.java
URL: 
http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaManager.java?rev=348972&r1=348971&r2=348972&view=diff
==
--- 
tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaManager.java
 (original)
+++ 
tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/session/DeltaManager.java
 Fri Nov 25 07:56:09 2005
@@ -738,7 +738,7 @@
 session.resetDeltaRequest();
 // FIXME How inform other session id cache like SingleSignOn
 // increment sessionCounter to correct stats report
-if (findSession(session.getIdInternal()) != null ) {
+if (findSession(session.getIdInternal()) == null ) {
 sessionCounter++;
 } else {
 sessionReplaceCounter++;

Modified: tomcat/container/tc5.5.x/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/webapps/docs/changelog.xml?rev=348972&r1=348971&r2=348972&view=diff
==
--- tomcat/container/tc5.5.x/webapps/docs/changelog.xml (original)
+++ tomcat/container/tc5.5.x/webapps/docs/changelog.xml Fri Nov 25 07:56:09 2005
@@ -160,6 +160,9 @@
   
 
   
+Fix that session replace messages are logged after node recovery get 
all session from master node. (pero)
+  
+  
 Fix that sendMessage signature at all DataSender subclasses must be 
changed.
 Now pooled and async modes working as expected. (pero)
   



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 32781] - attribute scheme not being recognized

2005-11-25 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=32781





--- Additional Comments From [EMAIL PROTECTED]  2005-11-25 20:01 ---
I'm working on an application which is affected by bug 32781 (scheme is 
reported as http instead of https) and was hoping that version 5.0.28 or 5.0.30 
would fix this, but it is still present. According to the comments on Bug 
33970, this fix was backported to 5.0. Will it be included in 5.0.30? I would 
prefer not to go to 5.5 yet as the java upgrade would be a major setback.



-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug, or are watching the assignee.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 32781] - attribute scheme not being recognized

2005-11-25 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=32781





--- Additional Comments From [EMAIL PROTECTED]  2005-11-25 20:11 ---
You can use JDK 1.4 with tomcat 5.5. 
What you need is also download and extract the compat package.

Have you test the tomcat 5.0 svn head?

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug, or are watching the assignee.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DO NOT REPLY [Bug 33743] - WebappClassLoader race condition

2005-11-25 Thread bugzilla
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=33743





--- Additional Comments From [EMAIL PROTECTED]  2005-11-25 21:53 ---
On which version is this fixed?
(kind of urgent for me to know...thanks!)


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug, or are watching the assignee.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: getContext() - spec interpretation

2005-11-25 Thread Bill Barker


- Original Message - 
From: "Mark Thomas" <[EMAIL PROTECTED]>

To: 
Sent: Thursday, November 24, 2005 11:34 AM
Subject: getContext() - spec interpretation



All,

I have been looking at bug 13040 and reviewing the current getContext() 
implementation. I saw Remy's comment from some time ago when fixing some 
related bugs 
(http://marc.theaimsgroup.com/?l=tomcat-dev&m=106008981803343&w=2) that 
this would be better if the spec mandated that the parameter passed to 
getContext() must be an exact match for a context path.


Having read the 2.4 spec several times I am pretty sure that is does say 
this, albeit not as directly as it might. I assume (perhaps wrongly) that 
any changes in this area will generate a lot of debate so I wanted to do 
the debate and then change the code.




I can't really dispute the interpretation of the spec, but the change is 
likely to break many more webapps then it fixes :(.


For TC 5, it would be nice to keep some backwards compatibility with 
something like:


MessageBytes uriMB = new MessageBytes();
uriMB.setString(uri);
MappingData md = new MappingData();
MessageBytes serverName = request.getCoyoteRequest().serverName();
request.getConnector().getMapper().map(serverName, uriMB, md);
if(md.context == null) {
   return null;
}
return ((Context)md.context).getServletContext();




The key parts of the spec are:
SRV.14.2.8 ServletContext

public ServletContext getContext(java.lang.String uripath)

uripath - a String specifying the context path of another web application 
in the container.



My interpretation is:
SRV.14.2.8 says the parameter is a context path
SRV.4.4 is very clear about what is context path is

Therefore, getContext() must look for an exact match of uripath against 
the context paths for the currently deployed web-apps.


My proposal, therefore is to change the getContext() implementation to 
look for an exact match. This is stricter than the current implementation 
(and may cause problems for some users) but will fix a number of odd 
behaviours including the one described in bug 13040.


In the unlikely event that no-one disagrees with my interpretation, I'll 
commit a fix over the weekend to TC4 and TC5. (The 2.3 spec has the exact 
same wording.)


Mark


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







This message is intended only for the use of the person(s) listed above as the 
intended recipient(s), and may contain information that is PRIVILEGED and 
CONFIDENTIAL.  If you are not an intended recipient, you may not read, copy, or 
distribute this message or any attachment. If you received this communication 
in error, please notify us immediately by e-mail and then delete all copies of 
this message and any attachments.

In addition you should be aware that ordinary (unencrypted) e-mail sent through 
the Internet is not secure. Do not send confidential or sensitive information, 
such as social security numbers, account numbers, personal identification 
numbers and passwords, to us via ordinary (unencrypted) e-mail.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r349082 - in /tomcat/sandbox/java/org/apache/tomcat/util/threads: ./ res/

2005-11-25 Thread costin
Author: costin
Date: Fri Nov 25 21:39:20 2005
New Revision: 349082

URL: http://svn.apache.org/viewcvs?rev=349082&view=rev
Log:
Add threads ( without Reaper and Expirer, not used or needed )

Added:
tomcat/sandbox/java/org/apache/tomcat/util/threads/
tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPool.java
tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPoolRunnable.java
tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadWithAttributes.java
tomcat/sandbox/java/org/apache/tomcat/util/threads/res/

tomcat/sandbox/java/org/apache/tomcat/util/threads/res/LocalStrings.properties

tomcat/sandbox/java/org/apache/tomcat/util/threads/res/LocalStrings_es.properties

tomcat/sandbox/java/org/apache/tomcat/util/threads/res/LocalStrings_fr.properties

tomcat/sandbox/java/org/apache/tomcat/util/threads/res/LocalStrings_ja.properties

Added: tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPool.java
URL: 
http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPool.java?rev=349082&view=auto
==
--- tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPool.java (added)
+++ tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPool.java Fri Nov 
25 21:39:20 2005
@@ -0,0 +1,838 @@
+/*
+ *  Copyright 1999-2005 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.tomcat.util.threads;
+
+import java.util.*;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.tomcat.util.res.StringManager;
+
+/**
+ * A thread pool that is trying to copy the apache process management.
+ *
+ * Should we remove this in favor of Doug Lea's thread package?
+ *
+ * @author Gal Shachor
+ * @author Yoav Shapira <[EMAIL PROTECTED]>
+ */
+public class ThreadPool  {
+
+private static Log log = LogFactory.getLog(ThreadPool.class);
+
+private static StringManager sm =
+StringManager.getManager("org.apache.tomcat.util.threads.res");
+
+private static boolean logfull=true;
+
+/*
+ * Default values ...
+ */
+public static final int MAX_THREADS = 200;
+public static final int MAX_THREADS_MIN = 10;
+public static final int MAX_SPARE_THREADS = 50;
+public static final int MIN_SPARE_THREADS = 4;
+public static final int WORK_WAIT_TIMEOUT = 60*1000;
+
+/*
+ * Where the threads are held.
+ */
+protected ControlRunnable[] pool = null;
+
+/*
+ * A monitor thread that monitors the pool for idel threads.
+ */
+protected MonitorRunnable monitor;
+
+
+/*
+ * Max number of threads that you can open in the pool.
+ */
+protected int maxThreads;
+
+/*
+ * Min number of idel threads that you can leave in the pool.
+ */
+protected int minSpareThreads;
+
+/*
+ * Max number of idel threads that you can leave in the pool.
+ */
+protected int maxSpareThreads;
+
+/*
+ * Number of threads in the pool.
+ */
+protected int currentThreadCount;
+
+/*
+ * Number of busy threads in the pool.
+ */
+protected int currentThreadsBusy;
+
+/*
+ * Flag that the pool should terminate all the threads and stop.
+ */
+protected boolean stopThePool;
+
+/* Flag to control if the main thread is 'daemon' */
+protected boolean isDaemon=true;
+
+/** The threads that are part of the pool.
+ * Key is Thread, value is the ControlRunnable
+ */
+protected Hashtable threads=new Hashtable();
+
+protected Vector listeners=new Vector();
+
+/** Name of the threadpool
+ */
+protected String name = "TP";
+
+/**
+ * Sequence.
+ */
+protected int sequence = 1;
+
+/**
+ * Thread priority.
+ */
+protected int threadPriority = Thread.NORM_PRIORITY;
+
+
+/**
+ * Constructor.
+ */
+public ThreadPool() {
+maxThreads = MAX_THREADS;
+maxSpareThreads = MAX_SPARE_THREADS;
+minSpareThreads = MIN_SPARE_THREADS;
+currentThreadCount = 0;
+currentThreadsBusy = 0;
+stopThePool = false;
+}
+
+
+/** Create a ThreadPool instance.
+ *
+ * @param jmx UNUSED 
+ * @return ThreadPool instance. If JMX support is requested, you need to
+ *   call register() in order to set a name.
+ */
+public sta

svn commit: r349084 - in /tomcat/sandbox/java/org/apache/tomcat/util/threads: ThreadPool.java ThreadPoolRunnable.java ThreadWithAttributes.java

2005-11-25 Thread costin
Author: costin
Date: Fri Nov 25 21:41:43 2005
New Revision: 349084

URL: http://svn.apache.org/viewcvs?rev=349084&view=rev
Log:
A small change to allow access to the 'param' field in
ThreadWithAttributes. This allows passing a param to the thread - like a
socket for example

Modified:
tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPool.java
tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPoolRunnable.java
tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadWithAttributes.java

Modified: tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPool.java
URL: 
http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPool.java?rev=349084&r1=349083&r2=349084&view=diff
==
--- tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPool.java 
(original)
+++ tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPool.java Fri Nov 
25 21:41:43 2005
@@ -301,14 +301,15 @@
  * Executes a given Runnable on a thread in the pool, block if needed.
  */
 public void runIt(ThreadPoolRunnable r) {
-if(null == r) {
-throw new NullPointerException();
-}
-
 ControlRunnable c = findControlRunnable();
 c.runIt(r);
 }
 
+public void runIt(ThreadPoolRunnable r, Object param) {
+ControlRunnable c = findControlRunnable();
+c.runIt(r, param);
+}
+
 private ControlRunnable findControlRunnable() {
 ControlRunnable c=null;
 
@@ -728,6 +729,11 @@
 p.removeThread(Thread.currentThread());
 }
 }
+
+public synchronized void runIt(ThreadPoolRunnable toRun) {
+runIt( toRun, null);
+}
+
 /** Run a task
  *
  * @param toRun
@@ -746,13 +752,11 @@
  *
  * @param toRun
  */
-public synchronized void runIt(ThreadPoolRunnable toRun) {
+public synchronized void runIt(ThreadPoolRunnable toRun, 
+Object param) {
this.toRun = toRun;
-   // Do not re-init, the whole idea is to run init only once per
-   // thread - the pool is supposed to run a single task, that is
-   // initialized once.
-// noThData = true;
 shouldRun = true;
+t.setParam(p, param);
 this.notify();
 }
 

Modified: 
tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPoolRunnable.java
URL: 
http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPoolRunnable.java?rev=349084&r1=349083&r2=349084&view=diff
==
--- tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPoolRunnable.java 
(original)
+++ tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadPoolRunnable.java 
Fri Nov 25 21:41:43 2005
@@ -18,6 +18,7 @@
 
 
 /** Implemented if you want to run a piece of code inside a thread pool.
+ *  You can also use Runnable + ThreadLocal or ThreadWithAttributes.
  */
 public interface ThreadPoolRunnable {
 // XXX use notes or a hashtable-like

Modified: 
tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadWithAttributes.java
URL: 
http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadWithAttributes.java?rev=349084&r1=349083&r2=349084&view=diff
==
--- 
tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadWithAttributes.java 
(original)
+++ 
tomcat/sandbox/java/org/apache/tomcat/util/threads/ThreadWithAttributes.java 
Fri Nov 25 21:41:43 2005
@@ -27,7 +27,8 @@
  * JDK < 1.4 ).
  *
  * The main use is to store 'state' for monitoring ( like "processing
- * request 'GET /' ").
+ * request 'GET /' "), and to simplify information passing between threads.
+ * 
  */
 public class ThreadWithAttributes extends Thread {
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



svn commit: r349085 - /tomcat/sandbox/java/org/apache/tomcat/util/net/NioEndpoint.java

2005-11-25 Thread costin
Author: costin
Date: Fri Nov 25 21:43:33 2005
New Revision: 349085

URL: http://svn.apache.org/viewcvs?rev=349085&view=rev
Log:
The nio endpoint. Uses the thread pool. Only accept is implemented - the
polling of keep alive needs merging some code in the http11protocol.

Added:
tomcat/sandbox/java/org/apache/tomcat/util/net/NioEndpoint.java

Added: tomcat/sandbox/java/org/apache/tomcat/util/net/NioEndpoint.java
URL: 
http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=349085&view=auto
==
--- tomcat/sandbox/java/org/apache/tomcat/util/net/NioEndpoint.java (added)
+++ tomcat/sandbox/java/org/apache/tomcat/util/net/NioEndpoint.java Fri Nov 25 
21:43:33 2005
@@ -0,0 +1,316 @@
+/*
+ *  Copyright 1999-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.tomcat.util.net;
+
+import java.io.IOException;
+import java.net.BindException;
+import java.net.InetSocketAddress;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.SocketAddress;
+import java.nio.channels.ClosedChannelException;
+import java.nio.channels.SelectableChannel;
+import java.nio.channels.SelectionKey;
+import java.nio.channels.Selector;
+import java.nio.channels.ServerSocketChannel;
+import java.nio.channels.SocketChannel;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.apache.tomcat.util.threads.ThreadPool;
+import org.apache.tomcat.util.threads.ThreadPoolRunnable;
+import org.apache.tomcat.util.threads.ThreadWithAttributes;
+
+
+/** All threads blocked in accept(). New thread created on demand.
+ * No use of ThreadPool or ServerSocketFactory.
+ * 
+ * 
+ */
+public class NioEndpoint extends SimpleEndpoint { 
+
+private final Object threadSync = new Object();
+
+// active acceptors
+private int acceptors=0;
+
+ThreadPool tp;
+
+public NioEndpoint() {
+tp=new ThreadPool();
+tp.setMinSpareThreads(2);
+tp.setMaxSpareThreads(8);
+}
+
+//  Configuration 
+//  Thread pool 
+
+public void setMaxThreads(int maxThreads) {
+if( maxThreads > 0)
+tp.setMaxThreads(maxThreads);
+}
+
+public int getMaxThreads() {
+return tp.getMaxThreads();
+}
+
+public void setMaxSpareThreads(int maxThreads) {
+if(maxThreads > 0) 
+tp.setMaxSpareThreads(maxThreads);
+}
+
+public int getMaxSpareThreads() {
+return tp.getMaxSpareThreads();
+}
+
+public void setMinSpareThreads(int minThreads) {
+if(minThreads > 0) 
+tp.setMinSpareThreads(minThreads);
+}
+
+public int getMinSpareThreads() {
+return tp.getMinSpareThreads();
+}
+
+public void setThreadPriority(int threadPriority) {
+  tp.setThreadPriority(threadPriority);
+}
+
+public int getThreadPriority() {
+  return tp.getThreadPriority();
+}
+
+public void setDaemon(boolean b) {
+daemon=b;
+tp.setDaemon( b );
+}
+
+public boolean getDaemon() {
+return tp.getDaemon();
+}
+
+public String getName() {
+return tp.getName();
+}
+
+public void setName(String name) {
+tp.setName(name);
+}
+
+
+// -- 
+public String getStrategy() {
+return "nio";
+}
+
+public int getCurrentThreadsBusy() {
+return curThreads;
+}
+
+//  Public methods 
+
+public void initEndpoint() throws IOException, InstantiationException {
+try {
+if(serverSocket==null) {
+try {
+ServerSocketChannel ssc=ServerSocketChannel.open();
+serverSocket = ssc.socket();
+SocketAddress sa = null;
+if (inet == null) {
+sa = new InetSocketAddress( port );
+} else {
+sa = new InetSocketAddress(inet, port);
+}
+serverSocket.bind( sa , backlog);
+} catch ( BindException be ) {
+throw new BindException(be.getMessage() + ":" + port);
+}
+}
+if( serverTimeout >= 0 )
+  

Re: svn commit: r349085 - /tomcat/sandbox/java/org/apache/tomcat/util/net/NioEndpoint.java

2005-11-25 Thread Bill Barker


- Original Message - 
From: <[EMAIL PROTECTED]>

To: 
Sent: Friday, November 25, 2005 9:43 PM
Subject: svn commit: r349085 - 
/tomcat/sandbox/java/org/apache/tomcat/util/net/NioEndpoint.java




Author: costin
Date: Fri Nov 25 21:43:33 2005
New Revision: 349085

URL: http://svn.apache.org/viewcvs?rev=349085&view=rev
Log:
The nio endpoint. Uses the thread pool. Only accept is implemented - the
polling of keep alive needs merging some code in the http11protocol.



Yup, it's still too incomplete to evaluate.  However from my work with 
NIO/AJP, using blocking sockets after the accept will totally s*ck in 
performance with NIO.  Unless you come up with something totally brilliant 
:), I still agree with JFA that non-blocking sockets is the only way to go 
with NIO.




This message is intended only for the use of the person(s) listed above as the 
intended recipient(s), and may contain information that is PRIVILEGED and 
CONFIDENTIAL.  If you are not an intended recipient, you may not read, copy, or 
distribute this message or any attachment. If you received this communication 
in error, please notify us immediately by e-mail and then delete all copies of 
this message and any attachments.

In addition you should be aware that ordinary (unencrypted) e-mail sent through 
the Internet is not secure. Do not send confidential or sensitive information, 
such as social security numbers, account numbers, personal identification 
numbers and passwords, to us via ordinary (unencrypted) e-mail.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: svn commit: r349085 - /tomcat/sandbox/java/org/apache/tomcat/util/net/NioEndpoint.java

2005-11-25 Thread Costin Manolache
On 11/25/05, Bill Barker <[EMAIL PROTECTED]> wrote:

> > The nio endpoint. Uses the thread pool. Only accept is implemented - the
> > polling of keep alive needs merging some code in the http11protocol.
> >
>
> Yup, it's still too incomplete to evaluate.  However from my work with
> NIO/AJP, using blocking sockets after the accept will totally s*ck in
> performance with NIO.  Unless you come up with something totally brilliant
> :), I still agree with JFA that non-blocking sockets is the only way to go
> with NIO.

Well, I also agree that non-blocking sockets are faster than blocking.
But as someone said, raw performance is not the most important thing
for most people :-)
My initial goal is to deal with the keep alives - i.e. not keep the
threads busy for all the idle connections. That would be a nice
improvement over the current non-nio connector, which can't do this,
and is pretty minimal and consistent with the current model.

I will eventually use the APR code for non-blocking parsing of the
request. Not sure if in this endpoint or I'll try another one - I kind
of like the fact that this code is very simple. I'm more interested in
experiments with how to do non-blocking processing at coyote level,
whatever happens in a servlet is limited by other factors - blocking
socket is not the biggest overhead.

I'll announce when it's 'complete' or 'ready to evaluate' - right now
it's just 'sandbox experiment'.
Right now - there is little point in benchmarking.

Costin

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: svn commit: r349085 - /tomcat/sandbox/java/org/apache/tomcat/util/net/NioEndpoint.java

2005-11-25 Thread Bill Barker


- Original Message - 
From: "Costin Manolache" <[EMAIL PROTECTED]>

To: "Tomcat Developers List" 
Sent: Friday, November 25, 2005 11:25 PM
Subject: Re: svn commit: r349085 - 
/tomcat/sandbox/java/org/apache/tomcat/util/net/NioEndpoint.java



On 11/25/05, Bill Barker <[EMAIL PROTECTED]> wrote:
> The nio endpoint. Uses the thread pool. Only accept is implemented - 
> the

> polling of keep alive needs merging some code in the http11protocol.
>

Yup, it's still too incomplete to evaluate.  However from my work with
NIO/AJP, using blocking sockets after the accept will totally s*ck in
performance with NIO.  Unless you come up with something totally 
brilliant
:), I still agree with JFA that non-blocking sockets is the only way to 
go

with NIO.


Well, I also agree that non-blocking sockets are faster than blocking.
But as someone said, raw performance is not the most important thing
for most people :-)
My initial goal is to deal with the keep alives - i.e. not keep the
threads busy for all the idle connections. That would be a nice
improvement over the current non-nio connector, which can't do this,
and is pretty minimal and consistent with the current model.

I will eventually use the APR code for non-blocking parsing of the
request. Not sure if in this endpoint or I'll try another one - I kind
of like the fact that this code is very simple. I'm more interested in
experiments with how to do non-blocking processing at coyote level,
whatever happens in a servlet is limited by other factors - blocking
socket is not the biggest overhead.



Urm, APR uses blocking sockets.  It uses APR to get around the fact that (at 
least with Sun's JVM) blocking NIO sockets totally s*ck.


Just look at the differences between the logic for ChannelNioSocket and 
AjpAprProcessor.



I'll announce when it's 'complete' or 'ready to evaluate' - right now
it's just 'sandbox experiment'.
Right now - there is little point in benchmarking.

Costin






This message is intended only for the use of the person(s) listed above as the 
intended recipient(s), and may contain information that is PRIVILEGED and 
CONFIDENTIAL.  If you are not an intended recipient, you may not read, copy, or 
distribute this message or any attachment. If you received this communication 
in error, please notify us immediately by e-mail and then delete all copies of 
this message and any attachments.

In addition you should be aware that ordinary (unencrypted) e-mail sent through 
the Internet is not secure. Do not send confidential or sensitive information, 
such as social security numbers, account numbers, personal identification 
numbers and passwords, to us via ordinary (unencrypted) e-mail.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]