You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by rj...@apache.org on 2008/01/28 19:48:13 UTC
svn commit: r615987 - in /tomcat/tc6.0.x/trunk: bin/
java/javax/servlet/jsp/resources/ java/javax/servlet/resources/
java/org/apache/catalina/core/ java/org/apache/catalina/ha/deploy/
java/org/apache/catalina/loader/ java/org/apache/catalina/tribes/gro...
Author: rjung
Date: Mon Jan 28 10:48:10 2008
New Revision: 615987
URL: http://svn.apache.org/viewvc?rev=615987&view=rev
Log:
Correct subversion properties of some items:
- remove executable from *.java, *.dtd, *.xsd and *.jsp
Some of those had executable set.
- add executable to *.bat and *.exe
Some of those had executable not set.
- set eol-style to native for *.java and *.xml
Some of those had no eol-style set
- add mime-type application/rtf to an rtf file
- switch mime-type to application/java-archive for *.jar
- set mime-type to application/xml-dtd for *.dtd
- correct mime-type to image/jpeg for two *.jpg files
Backport of r615583 from trunk.
Modified:
tomcat/tc6.0.x/trunk/bin/catalina.bat (props changed)
tomcat/tc6.0.x/trunk/java/javax/servlet/jsp/resources/jsp_2_0.xsd (props changed)
tomcat/tc6.0.x/trunk/java/javax/servlet/jsp/resources/jspxml.dtd (props changed)
tomcat/tc6.0.x/trunk/java/javax/servlet/jsp/resources/jspxml.xsd (props changed)
tomcat/tc6.0.x/trunk/java/javax/servlet/jsp/resources/web-jsptaglibrary_1_1.dtd (props changed)
tomcat/tc6.0.x/trunk/java/javax/servlet/jsp/resources/web-jsptaglibrary_1_2.dtd (props changed)
tomcat/tc6.0.x/trunk/java/javax/servlet/jsp/resources/web-jsptaglibrary_2_0.xsd (props changed)
tomcat/tc6.0.x/trunk/java/javax/servlet/resources/XMLSchema.dtd (props changed)
tomcat/tc6.0.x/trunk/java/javax/servlet/resources/datatypes.dtd (props changed)
tomcat/tc6.0.x/trunk/java/javax/servlet/resources/web-app_2_2.dtd (props changed)
tomcat/tc6.0.x/trunk/java/javax/servlet/resources/web-app_2_3.dtd (props changed)
tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardThreadExecutor.java (contents, props changed)
tomcat/tc6.0.x/trunk/java/org/apache/catalina/ha/deploy/mbeans-descriptors.xml (contents, props changed)
tomcat/tc6.0.x/trunk/java/org/apache/catalina/loader/VirtualWebappLoader.java (props changed)
tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java (contents, props changed)
tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/SSLValve.java (props changed)
tomcat/tc6.0.x/trunk/java/org/apache/naming/resources/VirtualDirContext.java (props changed)
tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/modeler/mbeans-descriptors.dtd (props changed)
tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/SocketProperties.java (contents, props changed)
tomcat/tc6.0.x/trunk/res/License.rtf (props changed)
tomcat/tc6.0.x/trunk/res/procrun/amd64/tomcat6.exe (props changed)
tomcat/tc6.0.x/trunk/res/procrun/amd64/tomcat6w.exe (props changed)
tomcat/tc6.0.x/trunk/res/procrun/ia64/tomcat6.exe (props changed)
tomcat/tc6.0.x/trunk/res/procrun/ia64/tomcat6w.exe (props changed)
tomcat/tc6.0.x/trunk/test/build.xml (props changed)
tomcat/tc6.0.x/trunk/test/org/apache/catalina/tomcat/util/http/TestCookies.java (props changed)
tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/interceptors/TestOrderInterceptor.java (contents, props changed)
tomcat/tc6.0.x/trunk/webapps/docs/tribes/leader-election-initiate-election.jpg (props changed)
tomcat/tc6.0.x/trunk/webapps/docs/tribes/leader-election-message-arrives.jpg (props changed)
tomcat/tc6.0.x/trunk/webapps/examples/WEB-INF/lib/jstl.jar (props changed)
tomcat/tc6.0.x/trunk/webapps/examples/WEB-INF/lib/standard.jar (props changed)
tomcat/tc6.0.x/trunk/webapps/manager/401.jsp (props changed)
Propchange: tomcat/tc6.0.x/trunk/bin/catalina.bat
------------------------------------------------------------------------------
svn:executable = *
Propchange: tomcat/tc6.0.x/trunk/java/javax/servlet/jsp/resources/jsp_2_0.xsd
('svn:executable' removed)
Propchange: tomcat/tc6.0.x/trunk/java/javax/servlet/jsp/resources/jspxml.dtd
('svn:executable' removed)
Propchange: tomcat/tc6.0.x/trunk/java/javax/servlet/jsp/resources/jspxml.dtd
------------------------------------------------------------------------------
svn:mime-type = application/xml-dtd
Propchange: tomcat/tc6.0.x/trunk/java/javax/servlet/jsp/resources/jspxml.xsd
('svn:executable' removed)
Propchange: tomcat/tc6.0.x/trunk/java/javax/servlet/jsp/resources/web-jsptaglibrary_1_1.dtd
('svn:executable' removed)
Propchange: tomcat/tc6.0.x/trunk/java/javax/servlet/jsp/resources/web-jsptaglibrary_1_1.dtd
------------------------------------------------------------------------------
svn:mime-type = application/xml-dtd
Propchange: tomcat/tc6.0.x/trunk/java/javax/servlet/jsp/resources/web-jsptaglibrary_1_2.dtd
('svn:executable' removed)
Propchange: tomcat/tc6.0.x/trunk/java/javax/servlet/jsp/resources/web-jsptaglibrary_1_2.dtd
------------------------------------------------------------------------------
svn:mime-type = application/xml-dtd
Propchange: tomcat/tc6.0.x/trunk/java/javax/servlet/jsp/resources/web-jsptaglibrary_2_0.xsd
('svn:executable' removed)
Propchange: tomcat/tc6.0.x/trunk/java/javax/servlet/resources/XMLSchema.dtd
------------------------------------------------------------------------------
svn:mime-type = application/xml-dtd
Propchange: tomcat/tc6.0.x/trunk/java/javax/servlet/resources/datatypes.dtd
------------------------------------------------------------------------------
svn:mime-type = application/xml-dtd
Propchange: tomcat/tc6.0.x/trunk/java/javax/servlet/resources/web-app_2_2.dtd
------------------------------------------------------------------------------
svn:mime-type = application/xml-dtd
Propchange: tomcat/tc6.0.x/trunk/java/javax/servlet/resources/web-app_2_3.dtd
------------------------------------------------------------------------------
svn:mime-type = application/xml-dtd
Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardThreadExecutor.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardThreadExecutor.java?rev=615987&r1=615986&r2=615987&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardThreadExecutor.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardThreadExecutor.java Mon Jan 28 10:48:10 2008
@@ -1,257 +1,257 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.catalina.core;
-
-import java.util.Collection;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.apache.catalina.Executor;
-import org.apache.catalina.LifecycleException;
-import org.apache.catalina.LifecycleListener;
-import org.apache.catalina.util.LifecycleSupport;
-import java.util.concurrent.RejectedExecutionException;
-
-public class StandardThreadExecutor implements Executor {
-
- // ---------------------------------------------- Properties
- protected int threadPriority = Thread.NORM_PRIORITY;
-
- protected boolean daemon = true;
-
- protected String namePrefix = "tomcat-exec-";
-
- protected int maxThreads = 200;
-
- protected int minSpareThreads = 25;
-
- protected int maxIdleTime = 60000;
-
- protected ThreadPoolExecutor executor = null;
-
- protected String name;
-
- private LifecycleSupport lifecycle = new LifecycleSupport(this);
- // ---------------------------------------------- Constructors
- public StandardThreadExecutor() {
- //empty constructor for the digester
- }
-
-
-
- // ---------------------------------------------- Public Methods
- public void start() throws LifecycleException {
- lifecycle.fireLifecycleEvent(BEFORE_START_EVENT, null);
- TaskQueue taskqueue = new TaskQueue();
- TaskThreadFactory tf = new TaskThreadFactory(namePrefix);
- lifecycle.fireLifecycleEvent(START_EVENT, null);
- executor = new ThreadPoolExecutor(getMinSpareThreads(), getMaxThreads(), maxIdleTime, TimeUnit.MILLISECONDS,taskqueue, tf);
- taskqueue.setParent( (ThreadPoolExecutor) executor);
- lifecycle.fireLifecycleEvent(AFTER_START_EVENT, null);
- }
-
- public void stop() throws LifecycleException{
- lifecycle.fireLifecycleEvent(BEFORE_STOP_EVENT, null);
- lifecycle.fireLifecycleEvent(STOP_EVENT, null);
- if ( executor != null ) executor.shutdown();
- executor = null;
- lifecycle.fireLifecycleEvent(AFTER_STOP_EVENT, null);
- }
-
- public void execute(Runnable command) {
- if ( executor != null ) {
- try {
- executor.execute(command);
- } catch (RejectedExecutionException rx) {
- //there could have been contention around the queue
- if ( !( (TaskQueue) executor.getQueue()).force(command) ) throw new RejectedExecutionException();
- }
- } else throw new IllegalStateException("StandardThreadPool not started.");
- }
-
- public int getThreadPriority() {
- return threadPriority;
- }
-
- public boolean isDaemon() {
-
- return daemon;
- }
-
- public String getNamePrefix() {
- return namePrefix;
- }
-
- public int getMaxIdleTime() {
- return maxIdleTime;
- }
-
- public int getMaxThreads() {
- return maxThreads;
- }
-
- public int getMinSpareThreads() {
- return minSpareThreads;
- }
-
- public String getName() {
- return name;
- }
-
- public void setThreadPriority(int threadPriority) {
- this.threadPriority = threadPriority;
- }
-
- public void setDaemon(boolean daemon) {
- this.daemon = daemon;
- }
-
- public void setNamePrefix(String namePrefix) {
- this.namePrefix = namePrefix;
- }
-
- public void setMaxIdleTime(int maxIdleTime) {
- this.maxIdleTime = maxIdleTime;
- }
-
- public void setMaxThreads(int maxThreads) {
- this.maxThreads = maxThreads;
- }
-
- public void setMinSpareThreads(int minSpareThreads) {
- this.minSpareThreads = minSpareThreads;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * Add a LifecycleEvent listener to this component.
- *
- * @param listener The listener to add
- */
- public void addLifecycleListener(LifecycleListener listener) {
- lifecycle.addLifecycleListener(listener);
- }
-
-
- /**
- * Get the lifecycle listeners associated with this lifecycle. If this
- * Lifecycle has no listeners registered, a zero-length array is returned.
- */
- public LifecycleListener[] findLifecycleListeners() {
- return lifecycle.findLifecycleListeners();
- }
-
-
- /**
- * Remove a LifecycleEvent listener from this component.
- *
- * @param listener The listener to remove
- */
- public void removeLifecycleListener(LifecycleListener listener) {
- lifecycle.removeLifecycleListener(listener);
- }
-
- // Statistics from the thread pool
- public int getActiveCount() {
- return (executor != null) ? executor.getActiveCount() : 0;
- }
-
- public long getCompletedTaskCount() {
- return (executor != null) ? executor.getCompletedTaskCount() : 0;
- }
-
- public int getCorePoolSize() {
- return (executor != null) ? executor.getCorePoolSize() : 0;
- }
-
- public int getLargestPoolSize() {
- return (executor != null) ? executor.getLargestPoolSize() : 0;
- }
-
- public int getPoolSize() {
- return (executor != null) ? executor.getPoolSize() : 0;
- }
-
- // ---------------------------------------------- TaskQueue Inner Class
- class TaskQueue extends LinkedBlockingQueue<Runnable> {
- ThreadPoolExecutor parent = null;
-
- public TaskQueue() {
- super();
- }
-
- public TaskQueue(int initialCapacity) {
- super(initialCapacity);
- }
-
- public TaskQueue(Collection<? extends Runnable> c) {
- super(c);
- }
-
- public void setParent(ThreadPoolExecutor tp) {
- parent = tp;
- }
-
- public boolean force(Runnable o) {
- if ( parent.isShutdown() ) throw new RejectedExecutionException("Executor not running, can't force a command into the queue");
- return super.offer(o); //forces the item onto the queue, to be used if the task is rejected
- }
-
- public boolean offer(Runnable o) {
- //we can't do any checks
- if (parent==null) return super.offer(o);
- //we are maxed out on threads, simply queue the object
- if (parent.getPoolSize() == parent.getMaximumPoolSize()) return super.offer(o);
- //we have idle threads, just add it to the queue
- //this is an approximation, so it could use some tuning
- if (parent.getActiveCount()<(parent.getPoolSize())) return super.offer(o);
- //if we have less threads than maximum force creation of a new thread
- if (parent.getPoolSize()<parent.getMaximumPoolSize()) return false;
- //if we reached here, we need to add it to the queue
- return super.offer(o);
- }
- }
-
- // ---------------------------------------------- ThreadFactory Inner Class
- class TaskThreadFactory implements ThreadFactory {
- final ThreadGroup group;
- final AtomicInteger threadNumber = new AtomicInteger(1);
- final String namePrefix;
-
- TaskThreadFactory(String namePrefix) {
- SecurityManager s = System.getSecurityManager();
- group = (s != null) ? s.getThreadGroup() : Thread.currentThread().getThreadGroup();
- this.namePrefix = namePrefix;
- }
-
- public Thread newThread(Runnable r) {
- Thread t = new Thread(group, r, namePrefix + threadNumber.getAndIncrement());
- t.setDaemon(daemon);
- t.setPriority(getThreadPriority());
- return t;
- }
- }
-
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.catalina.core;
+
+import java.util.Collection;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.catalina.Executor;
+import org.apache.catalina.LifecycleException;
+import org.apache.catalina.LifecycleListener;
+import org.apache.catalina.util.LifecycleSupport;
+import java.util.concurrent.RejectedExecutionException;
+
+public class StandardThreadExecutor implements Executor {
+
+ // ---------------------------------------------- Properties
+ protected int threadPriority = Thread.NORM_PRIORITY;
+
+ protected boolean daemon = true;
+
+ protected String namePrefix = "tomcat-exec-";
+
+ protected int maxThreads = 200;
+
+ protected int minSpareThreads = 25;
+
+ protected int maxIdleTime = 60000;
+
+ protected ThreadPoolExecutor executor = null;
+
+ protected String name;
+
+ private LifecycleSupport lifecycle = new LifecycleSupport(this);
+ // ---------------------------------------------- Constructors
+ public StandardThreadExecutor() {
+ //empty constructor for the digester
+ }
+
+
+
+ // ---------------------------------------------- Public Methods
+ public void start() throws LifecycleException {
+ lifecycle.fireLifecycleEvent(BEFORE_START_EVENT, null);
+ TaskQueue taskqueue = new TaskQueue();
+ TaskThreadFactory tf = new TaskThreadFactory(namePrefix);
+ lifecycle.fireLifecycleEvent(START_EVENT, null);
+ executor = new ThreadPoolExecutor(getMinSpareThreads(), getMaxThreads(), maxIdleTime, TimeUnit.MILLISECONDS,taskqueue, tf);
+ taskqueue.setParent( (ThreadPoolExecutor) executor);
+ lifecycle.fireLifecycleEvent(AFTER_START_EVENT, null);
+ }
+
+ public void stop() throws LifecycleException{
+ lifecycle.fireLifecycleEvent(BEFORE_STOP_EVENT, null);
+ lifecycle.fireLifecycleEvent(STOP_EVENT, null);
+ if ( executor != null ) executor.shutdown();
+ executor = null;
+ lifecycle.fireLifecycleEvent(AFTER_STOP_EVENT, null);
+ }
+
+ public void execute(Runnable command) {
+ if ( executor != null ) {
+ try {
+ executor.execute(command);
+ } catch (RejectedExecutionException rx) {
+ //there could have been contention around the queue
+ if ( !( (TaskQueue) executor.getQueue()).force(command) ) throw new RejectedExecutionException();
+ }
+ } else throw new IllegalStateException("StandardThreadPool not started.");
+ }
+
+ public int getThreadPriority() {
+ return threadPriority;
+ }
+
+ public boolean isDaemon() {
+
+ return daemon;
+ }
+
+ public String getNamePrefix() {
+ return namePrefix;
+ }
+
+ public int getMaxIdleTime() {
+ return maxIdleTime;
+ }
+
+ public int getMaxThreads() {
+ return maxThreads;
+ }
+
+ public int getMinSpareThreads() {
+ return minSpareThreads;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setThreadPriority(int threadPriority) {
+ this.threadPriority = threadPriority;
+ }
+
+ public void setDaemon(boolean daemon) {
+ this.daemon = daemon;
+ }
+
+ public void setNamePrefix(String namePrefix) {
+ this.namePrefix = namePrefix;
+ }
+
+ public void setMaxIdleTime(int maxIdleTime) {
+ this.maxIdleTime = maxIdleTime;
+ }
+
+ public void setMaxThreads(int maxThreads) {
+ this.maxThreads = maxThreads;
+ }
+
+ public void setMinSpareThreads(int minSpareThreads) {
+ this.minSpareThreads = minSpareThreads;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Add a LifecycleEvent listener to this component.
+ *
+ * @param listener The listener to add
+ */
+ public void addLifecycleListener(LifecycleListener listener) {
+ lifecycle.addLifecycleListener(listener);
+ }
+
+
+ /**
+ * Get the lifecycle listeners associated with this lifecycle. If this
+ * Lifecycle has no listeners registered, a zero-length array is returned.
+ */
+ public LifecycleListener[] findLifecycleListeners() {
+ return lifecycle.findLifecycleListeners();
+ }
+
+
+ /**
+ * Remove a LifecycleEvent listener from this component.
+ *
+ * @param listener The listener to remove
+ */
+ public void removeLifecycleListener(LifecycleListener listener) {
+ lifecycle.removeLifecycleListener(listener);
+ }
+
+ // Statistics from the thread pool
+ public int getActiveCount() {
+ return (executor != null) ? executor.getActiveCount() : 0;
+ }
+
+ public long getCompletedTaskCount() {
+ return (executor != null) ? executor.getCompletedTaskCount() : 0;
+ }
+
+ public int getCorePoolSize() {
+ return (executor != null) ? executor.getCorePoolSize() : 0;
+ }
+
+ public int getLargestPoolSize() {
+ return (executor != null) ? executor.getLargestPoolSize() : 0;
+ }
+
+ public int getPoolSize() {
+ return (executor != null) ? executor.getPoolSize() : 0;
+ }
+
+ // ---------------------------------------------- TaskQueue Inner Class
+ class TaskQueue extends LinkedBlockingQueue<Runnable> {
+ ThreadPoolExecutor parent = null;
+
+ public TaskQueue() {
+ super();
+ }
+
+ public TaskQueue(int initialCapacity) {
+ super(initialCapacity);
+ }
+
+ public TaskQueue(Collection<? extends Runnable> c) {
+ super(c);
+ }
+
+ public void setParent(ThreadPoolExecutor tp) {
+ parent = tp;
+ }
+
+ public boolean force(Runnable o) {
+ if ( parent.isShutdown() ) throw new RejectedExecutionException("Executor not running, can't force a command into the queue");
+ return super.offer(o); //forces the item onto the queue, to be used if the task is rejected
+ }
+
+ public boolean offer(Runnable o) {
+ //we can't do any checks
+ if (parent==null) return super.offer(o);
+ //we are maxed out on threads, simply queue the object
+ if (parent.getPoolSize() == parent.getMaximumPoolSize()) return super.offer(o);
+ //we have idle threads, just add it to the queue
+ //this is an approximation, so it could use some tuning
+ if (parent.getActiveCount()<(parent.getPoolSize())) return super.offer(o);
+ //if we have less threads than maximum force creation of a new thread
+ if (parent.getPoolSize()<parent.getMaximumPoolSize()) return false;
+ //if we reached here, we need to add it to the queue
+ return super.offer(o);
+ }
+ }
+
+ // ---------------------------------------------- ThreadFactory Inner Class
+ class TaskThreadFactory implements ThreadFactory {
+ final ThreadGroup group;
+ final AtomicInteger threadNumber = new AtomicInteger(1);
+ final String namePrefix;
+
+ TaskThreadFactory(String namePrefix) {
+ SecurityManager s = System.getSecurityManager();
+ group = (s != null) ? s.getThreadGroup() : Thread.currentThread().getThreadGroup();
+ this.namePrefix = namePrefix;
+ }
+
+ public Thread newThread(Runnable r) {
+ Thread t = new Thread(group, r, namePrefix + threadNumber.getAndIncrement());
+ t.setDaemon(daemon);
+ t.setPriority(getThreadPriority());
+ return t;
+ }
+ }
+
+
}
Propchange: tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/StandardThreadExecutor.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/ha/deploy/mbeans-descriptors.xml
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/ha/deploy/mbeans-descriptors.xml?rev=615987&r1=615986&r2=615987&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/ha/deploy/mbeans-descriptors.xml (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/ha/deploy/mbeans-descriptors.xml Mon Jan 28 10:48:10 2008
@@ -1,27 +1,27 @@
-<?xml version="1.0"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You 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.
--->
-<mbeans-descriptors>
- <mbean
- name="FarmWarDeployer"
- className="org.apache.catalina.mbeans.ClassNameMBean"
- description="Farm Deployer - Broken"
- domain="Catalina"
- group="Cluster"
- type="org.apache.catalina.ha.deploy.FarmWarDeployer">
- </mbean>
-</mbeans-descriptors>
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+-->
+<mbeans-descriptors>
+ <mbean
+ name="FarmWarDeployer"
+ className="org.apache.catalina.mbeans.ClassNameMBean"
+ description="Farm Deployer - Broken"
+ domain="Catalina"
+ group="Cluster"
+ type="org.apache.catalina.ha.deploy.FarmWarDeployer">
+ </mbean>
+</mbeans-descriptors>
Propchange: tomcat/tc6.0.x/trunk/java/org/apache/catalina/ha/deploy/mbeans-descriptors.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tomcat/tc6.0.x/trunk/java/org/apache/catalina/loader/VirtualWebappLoader.java
('svn:executable' removed)
Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java?rev=615987&r1=615986&r2=615987&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java Mon Jan 28 10:48:10 2008
@@ -1,179 +1,179 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.catalina.tribes.group.interceptors;
-
-import java.lang.ref.WeakReference;
-import java.util.Arrays;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.apache.catalina.tribes.ChannelException;
-import org.apache.catalina.tribes.ChannelInterceptor;
-import org.apache.catalina.tribes.ChannelMessage;
-import org.apache.catalina.tribes.Member;
-import org.apache.catalina.tribes.group.ChannelInterceptorBase;
-import org.apache.catalina.tribes.io.ChannelData;
-
-/**
- *
- * Sends a ping to all members.
- * Configure this interceptor with the TcpFailureDetector below it,
- * and the TcpFailureDetector will act as the membership guide.
- * @author Filip Hanik
- * @version 1.0
- */
-
-public class TcpPingInterceptor extends ChannelInterceptorBase {
-
- protected static org.apache.juli.logging.Log log =
- org.apache.juli.logging.LogFactory.getLog(TcpPingInterceptor.class);
-
- protected static byte[] TCP_PING_DATA = new byte[] {
- 79, -89, 115, 72, 121, -33, 67, -55, -97, 111, -119, -128, -95, 91, 7, 20,
- 125, -39, 82, 91, -21, -33, 67, -102, -73, 126, -66, -113, -127, 103, 30, -74,
- 55, 21, -66, -121, 69, 33, 76, -88, -65, 10, 77, 19, 83, 56, 21, 50,
- 85, -10, -108, -73, 58, -33, 33, 120, -111, 4, 125, -41, 114, -124, -64, -43};
-
- protected long interval = 1000; //1 second
-
- protected boolean useThread = false;
- protected boolean staticOnly = false;
- protected boolean running = true;
- protected PingThread thread = null;
- protected static AtomicInteger cnt = new AtomicInteger(0);
-
- WeakReference<TcpFailureDetector> failureDetector = null;
- WeakReference<StaticMembershipInterceptor> staticMembers = null;
-
- public synchronized void start(int svc) throws ChannelException {
- super.start(svc);
- running = true;
- if ( thread == null ) {
- thread = new PingThread();
- thread.setDaemon(true);
- thread.setName("TcpPingInterceptor.PingThread-"+cnt.addAndGet(1));
- thread.start();
- }
-
- //acquire the interceptors to invoke on send ping events
- ChannelInterceptor next = getNext();
- while ( next != null ) {
- if ( next instanceof TcpFailureDetector )
- failureDetector = new WeakReference<TcpFailureDetector>((TcpFailureDetector)next);
- if ( next instanceof StaticMembershipInterceptor )
- staticMembers = new WeakReference<StaticMembershipInterceptor>((StaticMembershipInterceptor)next);
- next = next.getNext();
- }
-
- }
-
- public void stop(int svc) throws ChannelException {
- running = false;
- if ( thread != null ) thread.interrupt();
- thread = null;
- super.stop(svc);
- }
-
- public void heartbeat() {
- super.heartbeat();
- if (!getUseThread()) sendPing();
- }
-
- public long getInterval() {
- return interval;
- }
-
- public void setInterval(long interval) {
- this.interval = interval;
- }
-
- public void setUseThread(boolean useThread) {
- this.useThread = useThread;
- }
-
- public void setStaticOnly(boolean staticOnly) {
- this.staticOnly = staticOnly;
- }
-
- public boolean getUseThread() {
- return useThread;
- }
-
- public boolean getStaticOnly() {
- return staticOnly;
- }
-
- protected void sendPing() {
- if (failureDetector.get()!=null) {
- //we have a reference to the failure detector
- //piggy back on that dude
- failureDetector.get().checkMembers(true);
- }else {
- if (staticOnly && staticMembers.get()!=null) {
- sendPingMessage(staticMembers.get().getMembers());
- } else {
- sendPingMessage(getMembers());
- }
- }
- }
-
- protected void sendPingMessage(Member[] members) {
- if ( members == null || members.length == 0 ) return;
- ChannelData data = new ChannelData(true);//generates a unique Id
- data.setAddress(getLocalMember(false));
- data.setTimestamp(System.currentTimeMillis());
- data.setOptions(getOptionFlag());
- try {
- super.sendMessage(members, data, null);
- }catch (ChannelException x) {
- log.warn("Unable to send TCP ping.",x);
- }
- }
-
- public void messageReceived(ChannelMessage msg) {
- //catch incoming
- boolean process = true;
- if ( okToProcess(msg.getOptions()) ) {
- //check to see if it is a ping message, if so, process = false
- process = ( (msg.getMessage().getLength() != TCP_PING_DATA.length) ||
- (!Arrays.equals(TCP_PING_DATA,msg.getMessage().getBytes()) ) );
- }//end if
-
- //ignore the message, it doesnt have the flag set
- if ( process ) super.messageReceived(msg);
- else if ( log.isDebugEnabled() ) log.debug("Received a TCP ping packet:"+msg);
- }//messageReceived
-
- protected class PingThread extends Thread {
- public void run() {
- while (running) {
- try {
- sleep(interval);
- sendPing();
- }catch ( InterruptedException ix ) {
- interrupted();
- }catch ( Exception x ) {
- log.warn("Unable to send ping from TCP ping thread.",x);
- }
- }
- }
- }
-
-
-
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.catalina.tribes.group.interceptors;
+
+import java.lang.ref.WeakReference;
+import java.util.Arrays;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.catalina.tribes.ChannelException;
+import org.apache.catalina.tribes.ChannelInterceptor;
+import org.apache.catalina.tribes.ChannelMessage;
+import org.apache.catalina.tribes.Member;
+import org.apache.catalina.tribes.group.ChannelInterceptorBase;
+import org.apache.catalina.tribes.io.ChannelData;
+
+/**
+ *
+ * Sends a ping to all members.
+ * Configure this interceptor with the TcpFailureDetector below it,
+ * and the TcpFailureDetector will act as the membership guide.
+ * @author Filip Hanik
+ * @version 1.0
+ */
+
+public class TcpPingInterceptor extends ChannelInterceptorBase {
+
+ protected static org.apache.juli.logging.Log log =
+ org.apache.juli.logging.LogFactory.getLog(TcpPingInterceptor.class);
+
+ protected static byte[] TCP_PING_DATA = new byte[] {
+ 79, -89, 115, 72, 121, -33, 67, -55, -97, 111, -119, -128, -95, 91, 7, 20,
+ 125, -39, 82, 91, -21, -33, 67, -102, -73, 126, -66, -113, -127, 103, 30, -74,
+ 55, 21, -66, -121, 69, 33, 76, -88, -65, 10, 77, 19, 83, 56, 21, 50,
+ 85, -10, -108, -73, 58, -33, 33, 120, -111, 4, 125, -41, 114, -124, -64, -43};
+
+ protected long interval = 1000; //1 second
+
+ protected boolean useThread = false;
+ protected boolean staticOnly = false;
+ protected boolean running = true;
+ protected PingThread thread = null;
+ protected static AtomicInteger cnt = new AtomicInteger(0);
+
+ WeakReference<TcpFailureDetector> failureDetector = null;
+ WeakReference<StaticMembershipInterceptor> staticMembers = null;
+
+ public synchronized void start(int svc) throws ChannelException {
+ super.start(svc);
+ running = true;
+ if ( thread == null ) {
+ thread = new PingThread();
+ thread.setDaemon(true);
+ thread.setName("TcpPingInterceptor.PingThread-"+cnt.addAndGet(1));
+ thread.start();
+ }
+
+ //acquire the interceptors to invoke on send ping events
+ ChannelInterceptor next = getNext();
+ while ( next != null ) {
+ if ( next instanceof TcpFailureDetector )
+ failureDetector = new WeakReference<TcpFailureDetector>((TcpFailureDetector)next);
+ if ( next instanceof StaticMembershipInterceptor )
+ staticMembers = new WeakReference<StaticMembershipInterceptor>((StaticMembershipInterceptor)next);
+ next = next.getNext();
+ }
+
+ }
+
+ public void stop(int svc) throws ChannelException {
+ running = false;
+ if ( thread != null ) thread.interrupt();
+ thread = null;
+ super.stop(svc);
+ }
+
+ public void heartbeat() {
+ super.heartbeat();
+ if (!getUseThread()) sendPing();
+ }
+
+ public long getInterval() {
+ return interval;
+ }
+
+ public void setInterval(long interval) {
+ this.interval = interval;
+ }
+
+ public void setUseThread(boolean useThread) {
+ this.useThread = useThread;
+ }
+
+ public void setStaticOnly(boolean staticOnly) {
+ this.staticOnly = staticOnly;
+ }
+
+ public boolean getUseThread() {
+ return useThread;
+ }
+
+ public boolean getStaticOnly() {
+ return staticOnly;
+ }
+
+ protected void sendPing() {
+ if (failureDetector.get()!=null) {
+ //we have a reference to the failure detector
+ //piggy back on that dude
+ failureDetector.get().checkMembers(true);
+ }else {
+ if (staticOnly && staticMembers.get()!=null) {
+ sendPingMessage(staticMembers.get().getMembers());
+ } else {
+ sendPingMessage(getMembers());
+ }
+ }
+ }
+
+ protected void sendPingMessage(Member[] members) {
+ if ( members == null || members.length == 0 ) return;
+ ChannelData data = new ChannelData(true);//generates a unique Id
+ data.setAddress(getLocalMember(false));
+ data.setTimestamp(System.currentTimeMillis());
+ data.setOptions(getOptionFlag());
+ try {
+ super.sendMessage(members, data, null);
+ }catch (ChannelException x) {
+ log.warn("Unable to send TCP ping.",x);
+ }
+ }
+
+ public void messageReceived(ChannelMessage msg) {
+ //catch incoming
+ boolean process = true;
+ if ( okToProcess(msg.getOptions()) ) {
+ //check to see if it is a ping message, if so, process = false
+ process = ( (msg.getMessage().getLength() != TCP_PING_DATA.length) ||
+ (!Arrays.equals(TCP_PING_DATA,msg.getMessage().getBytes()) ) );
+ }//end if
+
+ //ignore the message, it doesnt have the flag set
+ if ( process ) super.messageReceived(msg);
+ else if ( log.isDebugEnabled() ) log.debug("Received a TCP ping packet:"+msg);
+ }//messageReceived
+
+ protected class PingThread extends Thread {
+ public void run() {
+ while (running) {
+ try {
+ sleep(interval);
+ sendPing();
+ }catch ( InterruptedException ix ) {
+ interrupted();
+ }catch ( Exception x ) {
+ log.warn("Unable to send ping from TCP ping thread.",x);
+ }
+ }
+ }
+ }
+
+
+
+
+}
Propchange: tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/SSLValve.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tomcat/tc6.0.x/trunk/java/org/apache/naming/resources/VirtualDirContext.java
('svn:executable' removed)
Propchange: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/modeler/mbeans-descriptors.dtd
------------------------------------------------------------------------------
svn:mime-type = application/xml-dtd
Modified: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/SocketProperties.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/SocketProperties.java?rev=615987&r1=615986&r2=615987&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/SocketProperties.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/SocketProperties.java Mon Jan 28 10:48:10 2008
@@ -1,370 +1,370 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.net.Socket;
-import java.net.SocketException;
-/**
- * Properties that can be set in the <Connector> element
- * in server.xml. All properties are prefixed with "socket."
- * and are currently only working for the Nio connector
- *
- * @author Filip Hanik
- */
-public class SocketProperties {
- /**
- * Enable/disable key cache, this bounded cache stores
- * KeyAttachment objects to reduce GC
- * Default is 500
- * -1 is unlimited
- * 0 is disabled
- */
- protected int keyCache = 500;
-
- /**
- * Enable/disable socket processor cache, this bounded cache stores
- * SocketProcessor objects to reduce GC
- * Default is 500
- * -1 is unlimited
- * 0 is disabled
- */
- protected int processorCache = 500;
-
-
-
- /**
- * Enable/disable poller event cache, this bounded cache stores
- * PollerEvent objects to reduce GC for the poller
- * Default is 500
- * -1 is unlimited
- * 0 is disabled
- * >0 the max number of objects to keep in cache.
- */
- protected int eventCache = 500;
-
-
- /**
- * Enable/disable direct buffers for the network buffers
- * Default value is enabled
- */
- protected boolean directBuffer = false;
- /**
- * Socket receive buffer size in bytes (SO_RCVBUF)
- * Default value is 25188
- */
- protected int rxBufSize = 25188;
- /**
- * Socket send buffer size in bytes (SO_SNDBUF)
- * Default value is 43800
- */
- protected int txBufSize = 43800;
-
- /**
- * The application read buffer size in bytes.
- * Default value is rxBufSize
- */
- protected int appReadBufSize = 8192;
-
- /**
- * The application write buffer size in bytes
- * Default value is txBufSize
- */
- protected int appWriteBufSize = 8192;
-
- /**
- * NioChannel pool size for the endpoint,
- * this value is how many channels
- * -1 means unlimited cached, 0 means no cache
- * Default value is 500
- */
- protected int bufferPool = 500;
-
-
- /**
- * Buffer pool size in bytes to be cached
- * -1 means unlimited, 0 means no cache
- * Default value is 100MB (1024*1024*100 bytes)
- */
- protected int bufferPoolSize = 1024*1024*100;
-
- /**
- * TCP_NO_DELAY option, default is true
- */
- protected boolean tcpNoDelay = true;
- /**
- * SO_KEEPALIVE option, default is false
- */
- protected boolean soKeepAlive = false;
- /**
- * OOBINLINE option, default is true
- */
- protected boolean ooBInline = true;
- /**
- * SO_REUSEADDR option, default is true
- */
- protected boolean soReuseAddress = true;
- /**
- * SO_LINGER option, default is true, paired with the <code>soLingerTime</code> value
- */
- protected boolean soLingerOn = true;
- /**
- * SO_LINGER option, default is 25 seconds.
- */
- protected int soLingerTime = 25;
- /**
- * SO_TIMEOUT option, default is 5000 milliseconds
- */
- protected int soTimeout = 5000;
- /**
- * Traffic class option, value between 0 and 255
- * IPTOS_LOWCOST (0x02)
- * IPTOS_RELIABILITY (0x04)
- * IPTOS_THROUGHPUT (0x08)
- * IPTOS_LOWDELAY (0x10)
- * Default value is 0x04 | 0x08 | 0x010
- */
- protected int soTrafficClass = 0x04 | 0x08 | 0x010;
- /**
- * Performance preferences according to
- * http://java.sun.com/j2se/1.5.0/docs/api/java/net/Socket.html#setPerformancePreferences(int,%20int,%20int)
- * Default value is 1
- */
- protected int performanceConnectionTime = 1;
- /**
- * Performance preferences according to
- * http://java.sun.com/j2se/1.5.0/docs/api/java/net/Socket.html#setPerformancePreferences(int,%20int,%20int)
- * Default value is 0
- */
- protected int performanceLatency = 0;
- /**
- * Performance preferences according to
- * http://java.sun.com/j2se/1.5.0/docs/api/java/net/Socket.html#setPerformancePreferences(int,%20int,%20int)
- * Default value is 1
- */
- protected int performanceBandwidth = 1;
-
- /**
- * The minimum frequency of the timeout interval to avoid the
- * poller going boinkers during high traffic
- */
- protected long timeoutInterval = 1000;
-
-
- private Socket properties;
-
- public void setProperties(Socket socket) throws SocketException{
- socket.setReceiveBufferSize(rxBufSize);
- socket.setSendBufferSize(txBufSize);
- socket.setOOBInline(ooBInline);
- socket.setKeepAlive(soKeepAlive);
- socket.setPerformancePreferences(performanceConnectionTime,performanceLatency,performanceBandwidth);
- socket.setReuseAddress(soReuseAddress);
- socket.setSoLinger(soLingerOn,soLingerTime);
- socket.setSoTimeout(soTimeout);
- socket.setTcpNoDelay(tcpNoDelay);
- socket.setTrafficClass(soTrafficClass);
- }
-
- public boolean getDirectBuffer() {
- return directBuffer;
- }
-
- public boolean getOoBInline() {
- return ooBInline;
- }
-
- public int getPerformanceBandwidth() {
- return performanceBandwidth;
- }
-
- public int getPerformanceConnectionTime() {
- return performanceConnectionTime;
- }
-
- public int getPerformanceLatency() {
- return performanceLatency;
- }
-
- public int getRxBufSize() {
- return rxBufSize;
- }
-
- public boolean getSoKeepAlive() {
- return soKeepAlive;
- }
-
- public boolean getSoLingerOn() {
- return soLingerOn;
- }
-
- public int getSoLingerTime() {
- return soLingerTime;
- }
-
- public boolean getSoReuseAddress() {
- return soReuseAddress;
- }
-
- public int getSoTimeout() {
- return soTimeout;
- }
-
- public int getSoTrafficClass() {
- return soTrafficClass;
- }
-
- public boolean getTcpNoDelay() {
- return tcpNoDelay;
- }
-
- public int getTxBufSize() {
- return txBufSize;
- }
-
- public int getBufferPool() {
- return bufferPool;
- }
-
- public int getBufferPoolSize() {
- return bufferPoolSize;
- }
-
- public int getEventCache() {
- return eventCache;
- }
-
- public int getKeyCache() {
- return keyCache;
- }
-
- public Socket getProperties() {
- return properties;
- }
-
- public int getAppReadBufSize() {
- return appReadBufSize;
- }
-
- public int getAppWriteBufSize() {
- return appWriteBufSize;
- }
-
- public int getProcessorCache() {
- return processorCache;
- }
-
- public long getTimeoutInterval() {
- return timeoutInterval;
- }
-
- public int getDirectBufferPool() {
- return bufferPool;
- }
-
- public void setPerformanceConnectionTime(int performanceConnectionTime) {
- this.performanceConnectionTime = performanceConnectionTime;
- }
-
- public void setTxBufSize(int txBufSize) {
- this.txBufSize = txBufSize;
- }
-
- public void setTcpNoDelay(boolean tcpNoDelay) {
- this.tcpNoDelay = tcpNoDelay;
- }
-
- public void setSoTrafficClass(int soTrafficClass) {
- this.soTrafficClass = soTrafficClass;
- }
-
- public void setSoTimeout(int soTimeout) {
- this.soTimeout = soTimeout;
- }
-
- public void setSoReuseAddress(boolean soReuseAddress) {
- this.soReuseAddress = soReuseAddress;
- }
-
- public void setSoLingerTime(int soLingerTime) {
- this.soLingerTime = soLingerTime;
- }
-
- public void setSoKeepAlive(boolean soKeepAlive) {
- this.soKeepAlive = soKeepAlive;
- }
-
- public void setRxBufSize(int rxBufSize) {
- this.rxBufSize = rxBufSize;
- }
-
- public void setPerformanceLatency(int performanceLatency) {
- this.performanceLatency = performanceLatency;
- }
-
- public void setPerformanceBandwidth(int performanceBandwidth) {
- this.performanceBandwidth = performanceBandwidth;
- }
-
- public void setOoBInline(boolean ooBInline) {
- this.ooBInline = ooBInline;
- }
-
- public void setDirectBuffer(boolean directBuffer) {
- this.directBuffer = directBuffer;
- }
-
- public void setSoLingerOn(boolean soLingerOn) {
- this.soLingerOn = soLingerOn;
- }
-
- public void setBufferPool(int bufferPool) {
- this.bufferPool = bufferPool;
- }
-
- public void setBufferPoolSize(int bufferPoolSize) {
- this.bufferPoolSize = bufferPoolSize;
- }
-
- public void setEventCache(int eventCache) {
- this.eventCache = eventCache;
- }
-
- public void setKeyCache(int keyCache) {
- this.keyCache = keyCache;
- }
-
- public void setAppReadBufSize(int appReadBufSize) {
- this.appReadBufSize = appReadBufSize;
- }
-
- public void setAppWriteBufSize(int appWriteBufSize) {
- this.appWriteBufSize = appWriteBufSize;
- }
-
- public void setProcessorCache(int processorCache) {
- this.processorCache = processorCache;
- }
-
- public void setTimeoutInterval(long timeoutInterval) {
- this.timeoutInterval = timeoutInterval;
- }
-
- public void setDirectBufferPool(int directBufferPool) {
- this.bufferPool = directBufferPool;
- }
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.net.Socket;
+import java.net.SocketException;
+/**
+ * Properties that can be set in the <Connector> element
+ * in server.xml. All properties are prefixed with "socket."
+ * and are currently only working for the Nio connector
+ *
+ * @author Filip Hanik
+ */
+public class SocketProperties {
+ /**
+ * Enable/disable key cache, this bounded cache stores
+ * KeyAttachment objects to reduce GC
+ * Default is 500
+ * -1 is unlimited
+ * 0 is disabled
+ */
+ protected int keyCache = 500;
+
+ /**
+ * Enable/disable socket processor cache, this bounded cache stores
+ * SocketProcessor objects to reduce GC
+ * Default is 500
+ * -1 is unlimited
+ * 0 is disabled
+ */
+ protected int processorCache = 500;
+
+
+
+ /**
+ * Enable/disable poller event cache, this bounded cache stores
+ * PollerEvent objects to reduce GC for the poller
+ * Default is 500
+ * -1 is unlimited
+ * 0 is disabled
+ * >0 the max number of objects to keep in cache.
+ */
+ protected int eventCache = 500;
+
+
+ /**
+ * Enable/disable direct buffers for the network buffers
+ * Default value is enabled
+ */
+ protected boolean directBuffer = false;
+ /**
+ * Socket receive buffer size in bytes (SO_RCVBUF)
+ * Default value is 25188
+ */
+ protected int rxBufSize = 25188;
+ /**
+ * Socket send buffer size in bytes (SO_SNDBUF)
+ * Default value is 43800
+ */
+ protected int txBufSize = 43800;
+
+ /**
+ * The application read buffer size in bytes.
+ * Default value is rxBufSize
+ */
+ protected int appReadBufSize = 8192;
+
+ /**
+ * The application write buffer size in bytes
+ * Default value is txBufSize
+ */
+ protected int appWriteBufSize = 8192;
+
+ /**
+ * NioChannel pool size for the endpoint,
+ * this value is how many channels
+ * -1 means unlimited cached, 0 means no cache
+ * Default value is 500
+ */
+ protected int bufferPool = 500;
+
+
+ /**
+ * Buffer pool size in bytes to be cached
+ * -1 means unlimited, 0 means no cache
+ * Default value is 100MB (1024*1024*100 bytes)
+ */
+ protected int bufferPoolSize = 1024*1024*100;
+
+ /**
+ * TCP_NO_DELAY option, default is true
+ */
+ protected boolean tcpNoDelay = true;
+ /**
+ * SO_KEEPALIVE option, default is false
+ */
+ protected boolean soKeepAlive = false;
+ /**
+ * OOBINLINE option, default is true
+ */
+ protected boolean ooBInline = true;
+ /**
+ * SO_REUSEADDR option, default is true
+ */
+ protected boolean soReuseAddress = true;
+ /**
+ * SO_LINGER option, default is true, paired with the <code>soLingerTime</code> value
+ */
+ protected boolean soLingerOn = true;
+ /**
+ * SO_LINGER option, default is 25 seconds.
+ */
+ protected int soLingerTime = 25;
+ /**
+ * SO_TIMEOUT option, default is 5000 milliseconds
+ */
+ protected int soTimeout = 5000;
+ /**
+ * Traffic class option, value between 0 and 255
+ * IPTOS_LOWCOST (0x02)
+ * IPTOS_RELIABILITY (0x04)
+ * IPTOS_THROUGHPUT (0x08)
+ * IPTOS_LOWDELAY (0x10)
+ * Default value is 0x04 | 0x08 | 0x010
+ */
+ protected int soTrafficClass = 0x04 | 0x08 | 0x010;
+ /**
+ * Performance preferences according to
+ * http://java.sun.com/j2se/1.5.0/docs/api/java/net/Socket.html#setPerformancePreferences(int,%20int,%20int)
+ * Default value is 1
+ */
+ protected int performanceConnectionTime = 1;
+ /**
+ * Performance preferences according to
+ * http://java.sun.com/j2se/1.5.0/docs/api/java/net/Socket.html#setPerformancePreferences(int,%20int,%20int)
+ * Default value is 0
+ */
+ protected int performanceLatency = 0;
+ /**
+ * Performance preferences according to
+ * http://java.sun.com/j2se/1.5.0/docs/api/java/net/Socket.html#setPerformancePreferences(int,%20int,%20int)
+ * Default value is 1
+ */
+ protected int performanceBandwidth = 1;
+
+ /**
+ * The minimum frequency of the timeout interval to avoid the
+ * poller going boinkers during high traffic
+ */
+ protected long timeoutInterval = 1000;
+
+
+ private Socket properties;
+
+ public void setProperties(Socket socket) throws SocketException{
+ socket.setReceiveBufferSize(rxBufSize);
+ socket.setSendBufferSize(txBufSize);
+ socket.setOOBInline(ooBInline);
+ socket.setKeepAlive(soKeepAlive);
+ socket.setPerformancePreferences(performanceConnectionTime,performanceLatency,performanceBandwidth);
+ socket.setReuseAddress(soReuseAddress);
+ socket.setSoLinger(soLingerOn,soLingerTime);
+ socket.setSoTimeout(soTimeout);
+ socket.setTcpNoDelay(tcpNoDelay);
+ socket.setTrafficClass(soTrafficClass);
+ }
+
+ public boolean getDirectBuffer() {
+ return directBuffer;
+ }
+
+ public boolean getOoBInline() {
+ return ooBInline;
+ }
+
+ public int getPerformanceBandwidth() {
+ return performanceBandwidth;
+ }
+
+ public int getPerformanceConnectionTime() {
+ return performanceConnectionTime;
+ }
+
+ public int getPerformanceLatency() {
+ return performanceLatency;
+ }
+
+ public int getRxBufSize() {
+ return rxBufSize;
+ }
+
+ public boolean getSoKeepAlive() {
+ return soKeepAlive;
+ }
+
+ public boolean getSoLingerOn() {
+ return soLingerOn;
+ }
+
+ public int getSoLingerTime() {
+ return soLingerTime;
+ }
+
+ public boolean getSoReuseAddress() {
+ return soReuseAddress;
+ }
+
+ public int getSoTimeout() {
+ return soTimeout;
+ }
+
+ public int getSoTrafficClass() {
+ return soTrafficClass;
+ }
+
+ public boolean getTcpNoDelay() {
+ return tcpNoDelay;
+ }
+
+ public int getTxBufSize() {
+ return txBufSize;
+ }
+
+ public int getBufferPool() {
+ return bufferPool;
+ }
+
+ public int getBufferPoolSize() {
+ return bufferPoolSize;
+ }
+
+ public int getEventCache() {
+ return eventCache;
+ }
+
+ public int getKeyCache() {
+ return keyCache;
+ }
+
+ public Socket getProperties() {
+ return properties;
+ }
+
+ public int getAppReadBufSize() {
+ return appReadBufSize;
+ }
+
+ public int getAppWriteBufSize() {
+ return appWriteBufSize;
+ }
+
+ public int getProcessorCache() {
+ return processorCache;
+ }
+
+ public long getTimeoutInterval() {
+ return timeoutInterval;
+ }
+
+ public int getDirectBufferPool() {
+ return bufferPool;
+ }
+
+ public void setPerformanceConnectionTime(int performanceConnectionTime) {
+ this.performanceConnectionTime = performanceConnectionTime;
+ }
+
+ public void setTxBufSize(int txBufSize) {
+ this.txBufSize = txBufSize;
+ }
+
+ public void setTcpNoDelay(boolean tcpNoDelay) {
+ this.tcpNoDelay = tcpNoDelay;
+ }
+
+ public void setSoTrafficClass(int soTrafficClass) {
+ this.soTrafficClass = soTrafficClass;
+ }
+
+ public void setSoTimeout(int soTimeout) {
+ this.soTimeout = soTimeout;
+ }
+
+ public void setSoReuseAddress(boolean soReuseAddress) {
+ this.soReuseAddress = soReuseAddress;
+ }
+
+ public void setSoLingerTime(int soLingerTime) {
+ this.soLingerTime = soLingerTime;
+ }
+
+ public void setSoKeepAlive(boolean soKeepAlive) {
+ this.soKeepAlive = soKeepAlive;
+ }
+
+ public void setRxBufSize(int rxBufSize) {
+ this.rxBufSize = rxBufSize;
+ }
+
+ public void setPerformanceLatency(int performanceLatency) {
+ this.performanceLatency = performanceLatency;
+ }
+
+ public void setPerformanceBandwidth(int performanceBandwidth) {
+ this.performanceBandwidth = performanceBandwidth;
+ }
+
+ public void setOoBInline(boolean ooBInline) {
+ this.ooBInline = ooBInline;
+ }
+
+ public void setDirectBuffer(boolean directBuffer) {
+ this.directBuffer = directBuffer;
+ }
+
+ public void setSoLingerOn(boolean soLingerOn) {
+ this.soLingerOn = soLingerOn;
+ }
+
+ public void setBufferPool(int bufferPool) {
+ this.bufferPool = bufferPool;
+ }
+
+ public void setBufferPoolSize(int bufferPoolSize) {
+ this.bufferPoolSize = bufferPoolSize;
+ }
+
+ public void setEventCache(int eventCache) {
+ this.eventCache = eventCache;
+ }
+
+ public void setKeyCache(int keyCache) {
+ this.keyCache = keyCache;
+ }
+
+ public void setAppReadBufSize(int appReadBufSize) {
+ this.appReadBufSize = appReadBufSize;
+ }
+
+ public void setAppWriteBufSize(int appWriteBufSize) {
+ this.appWriteBufSize = appWriteBufSize;
+ }
+
+ public void setProcessorCache(int processorCache) {
+ this.processorCache = processorCache;
+ }
+
+ public void setTimeoutInterval(long timeoutInterval) {
+ this.timeoutInterval = timeoutInterval;
+ }
+
+ public void setDirectBufferPool(int directBufferPool) {
+ this.bufferPool = directBufferPool;
+ }
+
}
Propchange: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/SocketProperties.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tomcat/tc6.0.x/trunk/res/License.rtf
------------------------------------------------------------------------------
svn:mime-type = application/rtf
Propchange: tomcat/tc6.0.x/trunk/res/procrun/amd64/tomcat6.exe
------------------------------------------------------------------------------
svn:executable = *
Propchange: tomcat/tc6.0.x/trunk/res/procrun/amd64/tomcat6w.exe
------------------------------------------------------------------------------
svn:executable = *
Propchange: tomcat/tc6.0.x/trunk/res/procrun/ia64/tomcat6.exe
------------------------------------------------------------------------------
svn:executable = *
Propchange: tomcat/tc6.0.x/trunk/res/procrun/ia64/tomcat6w.exe
------------------------------------------------------------------------------
svn:executable = *
Propchange: tomcat/tc6.0.x/trunk/test/build.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tomcat/util/http/TestCookies.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/interceptors/TestOrderInterceptor.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/interceptors/TestOrderInterceptor.java?rev=615987&r1=615986&r2=615987&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/interceptors/TestOrderInterceptor.java (original)
+++ tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/interceptors/TestOrderInterceptor.java Mon Jan 28 10:48:10 2008
@@ -1,186 +1,186 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.catalina.tribes.test.interceptors;
-
-import org.apache.catalina.tribes.Channel;
-import org.apache.catalina.tribes.Member;
-import org.apache.catalina.tribes.group.GroupChannel;
-import org.apache.catalina.tribes.group.interceptors.NonBlockingCoordinator;
-import org.apache.catalina.tribes.group.interceptors.TcpFailureDetector;
-import junit.framework.TestCase;
-import junit.framework.TestResult;
-import junit.framework.TestSuite;
-import org.apache.catalina.tribes.ChannelListener;
-import java.io.Serializable;
-import org.apache.catalina.tribes.group.interceptors.OrderInterceptor;
-import org.apache.catalina.tribes.group.ChannelInterceptorBase;
-import org.apache.catalina.tribes.ChannelMessage;
-import org.apache.catalina.tribes.group.InterceptorPayload;
-import org.apache.catalina.tribes.ChannelException;
-import java.util.concurrent.atomic.AtomicInteger;
-
-public class TestOrderInterceptor extends TestCase {
-
- GroupChannel[] channels = null;
- OrderInterceptor[] orderitcs = null;
- MangleOrderInterceptor[] mangleitcs = null;
- TestListener[] test = null;
- int channelCount = 2;
- Thread[] threads = null;
- protected void setUp() throws Exception {
- System.out.println("Setup");
- super.setUp();
- channels = new GroupChannel[channelCount];
- orderitcs = new OrderInterceptor[channelCount];
- mangleitcs = new MangleOrderInterceptor[channelCount];
- test = new TestListener[channelCount];
- threads = new Thread[channelCount];
- for ( int i=0; i<channelCount; i++ ) {
- channels[i] = new GroupChannel();
-
- orderitcs[i] = new OrderInterceptor();
- mangleitcs[i] = new MangleOrderInterceptor();
- orderitcs[i].setExpire(Long.MAX_VALUE);
- channels[i].addInterceptor(orderitcs[i]);
- channels[i].addInterceptor(mangleitcs[i]);
- test[i] = new TestListener(i);
- channels[i].addChannelListener(test[i]);
- final int j = i;
- threads[i] = new Thread() {
- public void run() {
- try {
- channels[j].start(Channel.DEFAULT);
- Thread.sleep(50);
- } catch (Exception x) {
- x.printStackTrace();
- }
- }
- };
- }
- for ( int i=0; i<channelCount; i++ ) threads[i].start();
- for ( int i=0; i<channelCount; i++ ) threads[i].join();
- Thread.sleep(1000);
- }
-
- public void testOrder1() throws Exception {
- Member[] dest = channels[0].getMembers();
- final AtomicInteger value = new AtomicInteger(0);
- for ( int i=0; i<100; i++ ) {
- channels[0].send(dest,new Integer(value.getAndAdd(1)),0);
- }
- Thread.sleep(5000);
- for ( int i=0; i<test.length; i++ ) {
- super.assertEquals(false,test[i].fail);
- }
- }
-
- public void testOrder2() throws Exception {
- final Member[] dest = channels[0].getMembers();
- final AtomicInteger value = new AtomicInteger(0);
- Runnable run = new Runnable() {
- public void run() {
- for (int i = 0; i < 100; i++) {
- try {
- synchronized (channels[0]) {
- channels[0].send(dest, new Integer(value.getAndAdd(1)), 0);
- }
- }catch ( Exception x ) {
- x.printStackTrace();
- assertEquals(true,false);
- }
- }
- }
- };
- Thread[] threads = new Thread[5];
- for (int i=0;i<threads.length;i++) {
- threads[i] = new Thread(run);
- }
- for (int i=0;i<threads.length;i++) {
- threads[i].start();
- }
- for (int i=0;i<threads.length;i++) {
- threads[i].join();
- }
- Thread.sleep(5000);
- for ( int i=0; i<test.length; i++ ) {
- super.assertEquals(false,test[i].fail);
- }
- }
-
-
- protected void tearDown() throws Exception {
- System.out.println("tearDown");
- super.tearDown();
- for ( int i=0; i<channelCount; i++ ) {
- channels[i].stop(Channel.DEFAULT);
- }
- }
-
- public static void main(String[] args) throws Exception {
- TestSuite suite = new TestSuite();
- suite.addTestSuite(TestOrderInterceptor.class);
- suite.run(new TestResult());
- }
-
- public static class TestListener implements ChannelListener {
- int id = -1;
- public TestListener(int id) {
- this.id = id;
- }
- int cnt = 0;
- int total = 0;
- boolean fail = false;
- public synchronized void messageReceived(Serializable msg, Member sender) {
- total++;
- Integer i = (Integer)msg;
- if ( i.intValue() != cnt ) fail = true;
- else cnt++;
- System.out.println("Listener["+id+"] Message received:"+i+" Count:"+total+" Fail:"+fail);
-
- }
-
- public boolean accept(Serializable msg, Member sender) {
- return (msg instanceof Integer);
- }
- }
-
- public static class MangleOrderInterceptor extends ChannelInterceptorBase {
- int cnt = 1;
- ChannelMessage hold = null;
- Member[] dest = null;
- public synchronized void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws ChannelException {
- if ( hold == null ) {
- //System.out.println("Skipping message:"+msg);
- hold = (ChannelMessage)msg.deepclone();
- dest = new Member[destination.length];
- System.arraycopy(destination,0,dest,0,dest.length);
- } else {
- //System.out.println("Sending message:"+msg);
- super.sendMessage(destination,msg,payload);
- //System.out.println("Sending message:"+hold);
- super.sendMessage(dest,hold,null);
- hold = null;
- dest = null;
- }
- }
- }
-
-
-
-
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.catalina.tribes.test.interceptors;
+
+import org.apache.catalina.tribes.Channel;
+import org.apache.catalina.tribes.Member;
+import org.apache.catalina.tribes.group.GroupChannel;
+import org.apache.catalina.tribes.group.interceptors.NonBlockingCoordinator;
+import org.apache.catalina.tribes.group.interceptors.TcpFailureDetector;
+import junit.framework.TestCase;
+import junit.framework.TestResult;
+import junit.framework.TestSuite;
+import org.apache.catalina.tribes.ChannelListener;
+import java.io.Serializable;
+import org.apache.catalina.tribes.group.interceptors.OrderInterceptor;
+import org.apache.catalina.tribes.group.ChannelInterceptorBase;
+import org.apache.catalina.tribes.ChannelMessage;
+import org.apache.catalina.tribes.group.InterceptorPayload;
+import org.apache.catalina.tribes.ChannelException;
+import java.util.concurrent.atomic.AtomicInteger;
+
+public class TestOrderInterceptor extends TestCase {
+
+ GroupChannel[] channels = null;
+ OrderInterceptor[] orderitcs = null;
+ MangleOrderInterceptor[] mangleitcs = null;
+ TestListener[] test = null;
+ int channelCount = 2;
+ Thread[] threads = null;
+ protected void setUp() throws Exception {
+ System.out.println("Setup");
+ super.setUp();
+ channels = new GroupChannel[channelCount];
+ orderitcs = new OrderInterceptor[channelCount];
+ mangleitcs = new MangleOrderInterceptor[channelCount];
+ test = new TestListener[channelCount];
+ threads = new Thread[channelCount];
+ for ( int i=0; i<channelCount; i++ ) {
+ channels[i] = new GroupChannel();
+
+ orderitcs[i] = new OrderInterceptor();
+ mangleitcs[i] = new MangleOrderInterceptor();
+ orderitcs[i].setExpire(Long.MAX_VALUE);
+ channels[i].addInterceptor(orderitcs[i]);
+ channels[i].addInterceptor(mangleitcs[i]);
+ test[i] = new TestListener(i);
+ channels[i].addChannelListener(test[i]);
+ final int j = i;
+ threads[i] = new Thread() {
+ public void run() {
+ try {
+ channels[j].start(Channel.DEFAULT);
+ Thread.sleep(50);
+ } catch (Exception x) {
+ x.printStackTrace();
+ }
+ }
+ };
+ }
+ for ( int i=0; i<channelCount; i++ ) threads[i].start();
+ for ( int i=0; i<channelCount; i++ ) threads[i].join();
+ Thread.sleep(1000);
+ }
+
+ public void testOrder1() throws Exception {
+ Member[] dest = channels[0].getMembers();
+ final AtomicInteger value = new AtomicInteger(0);
+ for ( int i=0; i<100; i++ ) {
+ channels[0].send(dest,new Integer(value.getAndAdd(1)),0);
+ }
+ Thread.sleep(5000);
+ for ( int i=0; i<test.length; i++ ) {
+ super.assertEquals(false,test[i].fail);
+ }
+ }
+
+ public void testOrder2() throws Exception {
+ final Member[] dest = channels[0].getMembers();
+ final AtomicInteger value = new AtomicInteger(0);
+ Runnable run = new Runnable() {
+ public void run() {
+ for (int i = 0; i < 100; i++) {
+ try {
+ synchronized (channels[0]) {
+ channels[0].send(dest, new Integer(value.getAndAdd(1)), 0);
+ }
+ }catch ( Exception x ) {
+ x.printStackTrace();
+ assertEquals(true,false);
+ }
+ }
+ }
+ };
+ Thread[] threads = new Thread[5];
+ for (int i=0;i<threads.length;i++) {
+ threads[i] = new Thread(run);
+ }
+ for (int i=0;i<threads.length;i++) {
+ threads[i].start();
+ }
+ for (int i=0;i<threads.length;i++) {
+ threads[i].join();
+ }
+ Thread.sleep(5000);
+ for ( int i=0; i<test.length; i++ ) {
+ super.assertEquals(false,test[i].fail);
+ }
+ }
+
+
+ protected void tearDown() throws Exception {
+ System.out.println("tearDown");
+ super.tearDown();
+ for ( int i=0; i<channelCount; i++ ) {
+ channels[i].stop(Channel.DEFAULT);
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+ TestSuite suite = new TestSuite();
+ suite.addTestSuite(TestOrderInterceptor.class);
+ suite.run(new TestResult());
+ }
+
+ public static class TestListener implements ChannelListener {
+ int id = -1;
+ public TestListener(int id) {
+ this.id = id;
+ }
+ int cnt = 0;
+ int total = 0;
+ boolean fail = false;
+ public synchronized void messageReceived(Serializable msg, Member sender) {
+ total++;
+ Integer i = (Integer)msg;
+ if ( i.intValue() != cnt ) fail = true;
+ else cnt++;
+ System.out.println("Listener["+id+"] Message received:"+i+" Count:"+total+" Fail:"+fail);
+
+ }
+
+ public boolean accept(Serializable msg, Member sender) {
+ return (msg instanceof Integer);
+ }
+ }
+
+ public static class MangleOrderInterceptor extends ChannelInterceptorBase {
+ int cnt = 1;
+ ChannelMessage hold = null;
+ Member[] dest = null;
+ public synchronized void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws ChannelException {
+ if ( hold == null ) {
+ //System.out.println("Skipping message:"+msg);
+ hold = (ChannelMessage)msg.deepclone();
+ dest = new Member[destination.length];
+ System.arraycopy(destination,0,dest,0,dest.length);
+ } else {
+ //System.out.println("Sending message:"+msg);
+ super.sendMessage(destination,msg,payload);
+ //System.out.println("Sending message:"+hold);
+ super.sendMessage(dest,hold,null);
+ hold = null;
+ dest = null;
+ }
+ }
+ }
+
+
+
+
+
+}
Propchange: tomcat/tc6.0.x/trunk/test/org/apache/catalina/tribes/test/interceptors/TestOrderInterceptor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tomcat/tc6.0.x/trunk/webapps/docs/tribes/leader-election-initiate-election.jpg
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Mon Jan 28 10:48:10 2008
@@ -1 +1 @@
-application/octet-stream
+image/jpeg
Propchange: tomcat/tc6.0.x/trunk/webapps/docs/tribes/leader-election-message-arrives.jpg
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Mon Jan 28 10:48:10 2008
@@ -1 +1 @@
-application/octet-stream
+image/jpeg
Propchange: tomcat/tc6.0.x/trunk/webapps/examples/WEB-INF/lib/jstl.jar
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Mon Jan 28 10:48:10 2008
@@ -1 +1 @@
-application/octet-stream
+application/java-archive
Propchange: tomcat/tc6.0.x/trunk/webapps/examples/WEB-INF/lib/standard.jar
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Mon Jan 28 10:48:10 2008
@@ -1 +1 @@
-application/octet-stream
+application/java-archive
Propchange: tomcat/tc6.0.x/trunk/webapps/manager/401.jsp
('svn:executable' removed)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org