Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/transport/bio/MultipointBioSender.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/transport/bio/MultipointBioSender.java?view=diff&rev=531303&r1=531302&r2=531303
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/transport/bio/MultipointBioSender.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/transport/bio/MultipointBioSender.java Sun Apr 22 17:24:01 2007
@@ -1,18 +1,20 @@
/*
- * Copyright 1999,2006 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
- *
+ * 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.
+ * 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.transport.bio;
import java.io.IOException;
@@ -31,7 +33,7 @@
/**
*
* @author Filip Hanik
- * @version $Revision:$ $Date:$
+ * @version $Revision$ $Date$
*
*/
public class MultipointBioSender extends AbstractSender implements MultiPointSender {
Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/transport/bio/PooledMultiSender.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/transport/bio/PooledMultiSender.java?view=diff&rev=531303&r1=531302&r2=531303
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/transport/bio/PooledMultiSender.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/transport/bio/PooledMultiSender.java Sun Apr 22 17:24:01 2007
@@ -1,3 +1,19 @@
+/*
+ * 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.transport.bio;
import org.apache.catalina.tribes.transport.DataSender;
@@ -12,8 +28,6 @@
*
* <p>Description: </p>
*
- * <p>Copyright: Copyright (c) 2005</p>
- *
* <p>Company: </p>
*
* @author not attributable
@@ -64,4 +78,4 @@
//disconnect senders
}
-}
\ No newline at end of file
+}
Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/transport/nio/ParallelNioSender.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/transport/nio/ParallelNioSender.java?view=diff&rev=531303&r1=531302&r2=531303
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/transport/nio/ParallelNioSender.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/transport/nio/ParallelNioSender.java Sun Apr 22 17:24:01 2007
@@ -42,8 +42,6 @@
*
* <p>Description: </p>
*
- * <p>Copyright: Copyright (c) 2005</p>
- *
* <p>Company: </p>
*
* @author not attributable
Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/transport/nio/PooledParallelSender.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/transport/nio/PooledParallelSender.java?view=diff&rev=531303&r1=531302&r2=531303
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/transport/nio/PooledParallelSender.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/transport/nio/PooledParallelSender.java Sun Apr 22 17:24:01 2007
@@ -30,8 +30,6 @@
*
* <p>Description: </p>
*
- * <p>Copyright: Copyright (c) 2005</p>
- *
* <p>Company: </p>
*
* @author not attributable
Modified: tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java?view=diff&rev=531303&r1=531302&r2=531303
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProtocol.java Sun Apr 22 17:24:01 2007
@@ -24,6 +24,7 @@
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
import javax.management.MBeanRegistration;
import javax.management.MBeanServer;
@@ -330,7 +331,7 @@
protected static class AjpConnectionHandler implements Handler {
protected AjpAprProtocol proto;
- protected AtomicInteger registerCount = new AtomicInteger(0);
+ protected AtomicLong registerCount = new AtomicLong(0);
protected RequestGroupInfo global = new RequestGroupInfo();
protected ConcurrentLinkedQueue<AjpAprProcessor> recycledProcessors =
@@ -438,15 +439,15 @@
if (proto.getDomain() != null) {
synchronized (this) {
try {
- int count = registerCount.incrementAndGet();
- if (log.isDebugEnabled()) {
- log.debug("Register ["+processor+"] count=" + count);
- }
+ long count = registerCount.incrementAndGet();
RequestInfo rp = processor.getRequest().getRequestProcessor();
rp.setGlobalProcessor(global);
ObjectName rpName = new ObjectName
(proto.getDomain() + ":type=RequestProcessor,worker="
+ proto.getName() + ",name=AjpRequest" + count);
+ if (log.isDebugEnabled()) {
+ log.debug("Register " + rpName);
+ }
Registry.getRegistry(null, null).registerComponent(rp, rpName, null);
rp.setRpName(rpName);
} catch (Exception e) {
@@ -460,13 +461,12 @@
if (proto.getDomain() != null) {
synchronized (this) {
try {
- int count = registerCount.decrementAndGet();
- if (log.isDebugEnabled()) {
- log.debug("Unregister [" + processor + "] count=" + count);
- }
RequestInfo rp = processor.getRequest().getRequestProcessor();
rp.setGlobalProcessor(null);
ObjectName rpName = rp.getRpName();
+ if (log.isDebugEnabled()) {
+ log.debug("Unregister " + rpName);
+ }
Registry.getRegistry(null, null).unregisterComponent(rpName);
rp.setRpName(null);
} catch (Exception e) {
Modified: tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpProtocol.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpProtocol.java?view=diff&rev=531303&r1=531302&r2=531303
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpProtocol.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpProtocol.java Sun Apr 22 17:24:01 2007
@@ -25,6 +25,7 @@
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
import javax.management.MBeanRegistration;
import javax.management.MBeanServer;
@@ -323,7 +324,7 @@
protected static class AjpConnectionHandler implements Handler {
protected AjpProtocol proto;
- protected AtomicInteger registerCount = new AtomicInteger(0);
+ protected AtomicLong registerCount = new AtomicLong(0);
protected RequestGroupInfo global = new RequestGroupInfo();
protected ConcurrentLinkedQueue<AjpProcessor> recycledProcessors =
@@ -423,15 +424,15 @@
if (proto.getDomain() != null) {
synchronized (this) {
try {
- int count = registerCount.incrementAndGet();
- if (log.isDebugEnabled()) {
- log.debug("Register ["+processor+"] count=" + count);
- }
+ long count = registerCount.incrementAndGet();
RequestInfo rp = processor.getRequest().getRequestProcessor();
rp.setGlobalProcessor(global);
ObjectName rpName = new ObjectName
(proto.getDomain() + ":type=RequestProcessor,worker="
+ proto.getName() + ",name=AjpRequest" + count);
+ if (log.isDebugEnabled()) {
+ log.debug("Register " + rpName);
+ }
Registry.getRegistry(null, null).registerComponent(rp, rpName, null);
rp.setRpName(rpName);
} catch (Exception e) {
@@ -445,13 +446,12 @@
if (proto.getDomain() != null) {
synchronized (this) {
try {
- int count = registerCount.decrementAndGet();
- if (log.isDebugEnabled()) {
- log.debug("Unregister [" + processor + "] count=" + count);
- }
RequestInfo rp = processor.getRequest().getRequestProcessor();
rp.setGlobalProcessor(null);
ObjectName rpName = rp.getRpName();
+ if (log.isDebugEnabled()) {
+ log.debug("Unregister " + rpName);
+ }
Registry.getRegistry(null, null).unregisterComponent(rpName);
rp.setRpName(null);
} catch (Exception e) {
Modified: tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java?view=diff&rev=531303&r1=531302&r2=531303
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java Sun Apr 22 17:24:01 2007
@@ -26,6 +26,7 @@
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
import javax.management.MBeanRegistration;
import javax.management.MBeanServer;
@@ -481,7 +482,7 @@
static class Http11ConnectionHandler implements Handler {
protected Http11AprProtocol proto;
- protected AtomicInteger registerCount = new AtomicInteger(0);
+ protected AtomicLong registerCount = new AtomicLong(0);
protected RequestGroupInfo global = new RequestGroupInfo();
protected ConcurrentHashMap<Long, Http11AprProcessor> connections =
@@ -636,15 +637,15 @@
if (proto.getDomain() != null) {
synchronized (this) {
try {
- int count = registerCount.incrementAndGet();
- if (log.isDebugEnabled()) {
- log.debug("Register ["+processor+"] count=" + count);
- }
+ long count = registerCount.incrementAndGet();
RequestInfo rp = processor.getRequest().getRequestProcessor();
rp.setGlobalProcessor(global);
ObjectName rpName = new ObjectName
(proto.getDomain() + ":type=RequestProcessor,worker="
+ proto.getName() + ",name=HttpRequest" + count);
+ if (log.isDebugEnabled()) {
+ log.debug("Register " + rpName);
+ }
Registry.getRegistry(null, null).registerComponent(rp, rpName, null);
rp.setRpName(rpName);
} catch (Exception e) {
@@ -658,13 +659,12 @@
if (proto.getDomain() != null) {
synchronized (this) {
try {
- int count = registerCount.decrementAndGet();
- if (log.isDebugEnabled()) {
- log.debug("Unregister [" + processor + "] count=" + count);
- }
RequestInfo rp = processor.getRequest().getRequestProcessor();
rp.setGlobalProcessor(null);
ObjectName rpName = rp.getRpName();
+ if (log.isDebugEnabled()) {
+ log.debug("Unregister " + rpName);
+ }
Registry.getRegistry(null, null).unregisterComponent(rpName);
rp.setRpName(null);
} catch (Exception e) {
Modified: tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11Protocol.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11Protocol.java?view=diff&rev=531303&r1=531302&r2=531303
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11Protocol.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/Http11Protocol.java Sun Apr 22 17:24:01 2007
@@ -25,6 +25,7 @@
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
import javax.management.MBeanRegistration;
import javax.management.MBeanServer;
@@ -515,7 +516,7 @@
protected static class Http11ConnectionHandler implements Handler {
protected Http11Protocol proto;
- protected AtomicInteger registerCount = new AtomicInteger(0);
+ protected AtomicLong registerCount = new AtomicLong(0);
protected RequestGroupInfo global = new RequestGroupInfo();
protected ConcurrentLinkedQueue<Http11Processor> recycledProcessors =
@@ -635,15 +636,15 @@
if (proto.getDomain() != null) {
synchronized (this) {
try {
- int count = registerCount.incrementAndGet();
- if (log.isDebugEnabled()) {
- log.debug("Register ["+processor+"] count=" + count);
- }
+ long count = registerCount.incrementAndGet();
RequestInfo rp = processor.getRequest().getRequestProcessor();
rp.setGlobalProcessor(global);
ObjectName rpName = new ObjectName
(proto.getDomain() + ":type=RequestProcessor,worker="
+ proto.getName() + ",name=HttpRequest" + count);
+ if (log.isDebugEnabled()) {
+ log.debug("Register " + rpName);
+ }
Registry.getRegistry(null, null).registerComponent(rp, rpName, null);
rp.setRpName(rpName);
} catch (Exception e) {
@@ -657,13 +658,12 @@
if (proto.getDomain() != null) {
synchronized (this) {
try {
- int count = registerCount.decrementAndGet();
- if (log.isDebugEnabled()) {
- log.debug("Unregister [" + processor + "] count=" + count);
- }
RequestInfo rp = processor.getRequest().getRequestProcessor();
rp.setGlobalProcessor(null);
ObjectName rpName = rp.getRpName();
+ if (log.isDebugEnabled()) {
+ log.debug("Unregister " + rpName);
+ }
Registry.getRegistry(null, null).unregisterComponent(rpName);
rp.setRpName(null);
} catch (Exception e) {
Modified: tomcat/tc6.0.x/trunk/java/org/apache/jasper/runtime/PageContextImpl.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/jasper/runtime/PageContextImpl.java?view=diff&rev=531303&r1=531302&r2=531303
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/jasper/runtime/PageContextImpl.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/jasper/runtime/PageContextImpl.java Sun Apr 22 17:24:01 2007
@@ -55,8 +55,6 @@
import org.apache.jasper.el.VariableResolverImpl;
import org.apache.jasper.security.SecurityUtil;
import org.apache.jasper.util.Enumerator;
-import org.apache.juli.logging.Log;
-import org.apache.juli.logging.LogFactory;
/**
* Implementation of the PageContext class from the JSP spec. Also doubles as a
@@ -71,9 +69,6 @@
* @author Jacob Hookom
*/
public class PageContextImpl extends PageContext {
-
- // Logger
- private static Log log = LogFactory.getLog(PageContextImpl.class);
private BodyContentImpl[] outs;
Modified: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsSerSource.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsSerSource.java?view=diff&rev=531303&r1=531302&r2=531303
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsSerSource.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsSerSource.java Sun Apr 22 17:24:01 2007
@@ -1,3 +1,19 @@
+/*
+ * 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.modeler.modules;
import java.io.InputStream;
Modified: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/modeler/modules/MbeansSource.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/modeler/modules/MbeansSource.java?view=diff&rev=531303&r1=531302&r2=531303
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/modeler/modules/MbeansSource.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/modeler/modules/MbeansSource.java Sun Apr 22 17:24:01 2007
@@ -1,3 +1,19 @@
+/*
+ * 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.modeler.modules;
import java.io.FileNotFoundException;
Modified: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/modeler/modules/MbeansSourceMBean.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/modeler/modules/MbeansSourceMBean.java?view=diff&rev=531303&r1=531302&r2=531303
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/modeler/modules/MbeansSourceMBean.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/modeler/modules/MbeansSourceMBean.java Sun Apr 22 17:24:01 2007
@@ -1,3 +1,19 @@
+/*
+ * 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.modeler.modules;
import java.util.List;
Modified: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/modeler/modules/ModelerSource.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/modeler/modules/ModelerSource.java?view=diff&rev=531303&r1=531302&r2=531303
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/modeler/modules/ModelerSource.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/modeler/modules/ModelerSource.java Sun Apr 22 17:24:01 2007
@@ -1,3 +1,19 @@
+/*
+ * 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.modeler.modules;
import java.io.File;
Modified: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioBlockingSelector.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioBlockingSelector.java?view=diff&rev=531303&r1=531302&r2=531303
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioBlockingSelector.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioBlockingSelector.java Sun Apr 22 17:24:01 2007
@@ -1,163 +1,164 @@
-/*
- * Copyright 2005-2006 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.EOFException;
-import java.io.IOException;
-import java.net.SocketTimeoutException;
-import java.nio.ByteBuffer;
-import java.nio.channels.SelectionKey;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.tomcat.util.net.NioEndpoint.KeyAttachment;
-
-public class NioBlockingSelector {
- public NioBlockingSelector() {
- }
-
- /**
- * Performs a blocking write using the bytebuffer for data to be written
- * If the <code>selector</code> parameter is null, then it will perform a busy write that could
- * take up a lot of CPU cycles.
- * @param buf ByteBuffer - the buffer containing the data, we will write as long as <code>(buf.hasRemaining()==true)</code>
- * @param socket SocketChannel - the socket to write data to
- * @param writeTimeout long - the timeout for this write operation in milliseconds, -1 means no timeout
- * @return int - returns the number of bytes written
- * @throws EOFException if write returns -1
- * @throws SocketTimeoutException if the write times out
- * @throws IOException if an IO Exception occurs in the underlying socket logic
- */
- public static int write(ByteBuffer buf, NioChannel socket, long writeTimeout) throws IOException {
- SelectionKey key = socket.getIOChannel().keyFor(socket.getPoller().getSelector());
- int written = 0;
- boolean timedout = false;
- int keycount = 1; //assume we can write
- long time = System.currentTimeMillis(); //start the timeout timer
- if (socket.getBufHandler().getWriteBuffer() != buf) {
- socket.getBufHandler().getWriteBuffer().put(buf);
- buf = socket.getBufHandler().getWriteBuffer();
- }
- try {
- while ( (!timedout) && buf.hasRemaining()) {
- if (keycount > 0) { //only write if we were registered for a write
- int cnt = socket.write(buf); //write the data
- if (cnt == -1)
- throw new EOFException();
- written += cnt;
- if (cnt > 0) {
- time = System.currentTimeMillis(); //reset our timeout timer
- continue; //we successfully wrote, try again without a selector
- }
- }
- if ( key == null ) throw new IOException("Key no longer registered");
- KeyAttachment att = (KeyAttachment) key.attachment();
- try {
- if ( att.getLatch()==null || att.getLatch().getCount()==0) att.startLatch(1);
- if ( att.interestOps() == 0) socket.getPoller().add(socket,SelectionKey.OP_WRITE);
- att.getLatch().await(writeTimeout,TimeUnit.MILLISECONDS);
- }catch (InterruptedException ignore) {
- Thread.interrupted();
- }
- if ( att.getLatch()!=null && att.getLatch().getCount()> 0) {
- //we got interrupted, but we haven't received notification from the poller.
- keycount = 0;
- }else {
- //latch countdown has happened
- keycount = 1;
- att.resetLatch();
- }
-
- if (writeTimeout > 0 && (keycount == 0))
- timedout = (System.currentTimeMillis() - time) >= writeTimeout;
- } //while
- if (timedout)
- throw new SocketTimeoutException();
- } finally {
- if (timedout && key != null) {
- cancelKey(socket, key);
- }
- }
- return written;
- }
-
- private static void cancelKey(final NioChannel socket, final SelectionKey key) {
- socket.getPoller().addEvent(
- new Runnable() {
- public void run() {
- key.cancel();
- }
- });
- }
-
- /**
- * Performs a blocking read using the bytebuffer for data to be read
- * If the <code>selector</code> parameter is null, then it will perform a busy read that could
- * take up a lot of CPU cycles.
- * @param buf ByteBuffer - the buffer containing the data, we will read as until we have read at least one byte or we timed out
- * @param socket SocketChannel - the socket to write data to
- * @param selector Selector - the selector to use for blocking, if null then a busy read will be initiated
- * @param readTimeout long - the timeout for this read operation in milliseconds, -1 means no timeout
- * @return int - returns the number of bytes read
- * @throws EOFException if read returns -1
- * @throws SocketTimeoutException if the read times out
- * @throws IOException if an IO Exception occurs in the underlying socket logic
- */
- public static int read(ByteBuffer buf, NioChannel socket, long readTimeout) throws IOException {
- final SelectionKey key = socket.getIOChannel().keyFor(socket.getPoller().getSelector());
- int read = 0;
- boolean timedout = false;
- int keycount = 1; //assume we can write
- long time = System.currentTimeMillis(); //start the timeout timer
- try {
- while ( (!timedout) && read == 0) {
- if (keycount > 0) { //only read if we were registered for a read
- int cnt = socket.read(buf);
- if (cnt == -1)
- throw new EOFException();
- read += cnt;
- if (cnt > 0)
- break;
- }
- KeyAttachment att = (KeyAttachment) key.attachment();
- try {
- if ( att.getLatch()==null || att.getLatch().getCount()==0) att.startLatch(1);
- if ( att.interestOps() == 0) socket.getPoller().add(socket,SelectionKey.OP_READ);
- att.getLatch().await(readTimeout,TimeUnit.MILLISECONDS);
- }catch (InterruptedException ignore) {
- Thread.interrupted();
- }
- if ( att.getLatch()!=null && att.getLatch().getCount()> 0) {
- //we got interrupted, but we haven't received notification from the poller.
- keycount = 0;
- }else {
- //latch countdown has happened
- keycount = 1;
- att.resetLatch();
- }
- if (readTimeout > 0 && (keycount == 0))
- timedout = (System.currentTimeMillis() - time) >= readTimeout;
- } //while
- if (timedout)
- throw new SocketTimeoutException();
- } finally {
- if (timedout && key != null) {
- cancelKey(socket,key);
- }
- }
- return read;
- }
-
+/*
+ * 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.io.EOFException;
+import java.io.IOException;
+import java.net.SocketTimeoutException;
+import java.nio.ByteBuffer;
+import java.nio.channels.SelectionKey;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.tomcat.util.net.NioEndpoint.KeyAttachment;
+
+public class NioBlockingSelector {
+ public NioBlockingSelector() {
+ }
+
+ /**
+ * Performs a blocking write using the bytebuffer for data to be written
+ * If the <code>selector</code> parameter is null, then it will perform a busy write that could
+ * take up a lot of CPU cycles.
+ * @param buf ByteBuffer - the buffer containing the data, we will write as long as <code>(buf.hasRemaining()==true)</code>
+ * @param socket SocketChannel - the socket to write data to
+ * @param writeTimeout long - the timeout for this write operation in milliseconds, -1 means no timeout
+ * @return int - returns the number of bytes written
+ * @throws EOFException if write returns -1
+ * @throws SocketTimeoutException if the write times out
+ * @throws IOException if an IO Exception occurs in the underlying socket logic
+ */
+ public static int write(ByteBuffer buf, NioChannel socket, long writeTimeout) throws IOException {
+ SelectionKey key = socket.getIOChannel().keyFor(socket.getPoller().getSelector());
+ int written = 0;
+ boolean timedout = false;
+ int keycount = 1; //assume we can write
+ long time = System.currentTimeMillis(); //start the timeout timer
+ if (socket.getBufHandler().getWriteBuffer() != buf) {
+ socket.getBufHandler().getWriteBuffer().put(buf);
+ buf = socket.getBufHandler().getWriteBuffer();
+ }
+ try {
+ while ( (!timedout) && buf.hasRemaining()) {
+ if (keycount > 0) { //only write if we were registered for a write
+ int cnt = socket.write(buf); //write the data
+ if (cnt == -1)
+ throw new EOFException();
+ written += cnt;
+ if (cnt > 0) {
+ time = System.currentTimeMillis(); //reset our timeout timer
+ continue; //we successfully wrote, try again without a selector
+ }
+ }
+ if ( key == null ) throw new IOException("Key no longer registered");
+ KeyAttachment att = (KeyAttachment) key.attachment();
+ try {
+ if ( att.getLatch()==null || att.getLatch().getCount()==0) att.startLatch(1);
+ if ( att.interestOps() == 0) socket.getPoller().add(socket,SelectionKey.OP_WRITE);
+ att.getLatch().await(writeTimeout,TimeUnit.MILLISECONDS);
+ }catch (InterruptedException ignore) {
+ Thread.interrupted();
+ }
+ if ( att.getLatch()!=null && att.getLatch().getCount()> 0) {
+ //we got interrupted, but we haven't received notification from the poller.
+ keycount = 0;
+ }else {
+ //latch countdown has happened
+ keycount = 1;
+ att.resetLatch();
+ }
+
+ if (writeTimeout > 0 && (keycount == 0))
+ timedout = (System.currentTimeMillis() - time) >= writeTimeout;
+ } //while
+ if (timedout)
+ throw new SocketTimeoutException();
+ } finally {
+ if (timedout && key != null) {
+ cancelKey(socket, key);
+ }
+ }
+ return written;
+ }
+
+ private static void cancelKey(final NioChannel socket, final SelectionKey key) {
+ socket.getPoller().addEvent(
+ new Runnable() {
+ public void run() {
+ key.cancel();
+ }
+ });
+ }
+
+ /**
+ * Performs a blocking read using the bytebuffer for data to be read
+ * If the <code>selector</code> parameter is null, then it will perform a busy read that could
+ * take up a lot of CPU cycles.
+ * @param buf ByteBuffer - the buffer containing the data, we will read as until we have read at least one byte or we timed out
+ * @param socket SocketChannel - the socket to write data to
+ * @param selector Selector - the selector to use for blocking, if null then a busy read will be initiated
+ * @param readTimeout long - the timeout for this read operation in milliseconds, -1 means no timeout
+ * @return int - returns the number of bytes read
+ * @throws EOFException if read returns -1
+ * @throws SocketTimeoutException if the read times out
+ * @throws IOException if an IO Exception occurs in the underlying socket logic
+ */
+ public static int read(ByteBuffer buf, NioChannel socket, long readTimeout) throws IOException {
+ final SelectionKey key = socket.getIOChannel().keyFor(socket.getPoller().getSelector());
+ int read = 0;
+ boolean timedout = false;
+ int keycount = 1; //assume we can write
+ long time = System.currentTimeMillis(); //start the timeout timer
+ try {
+ while ( (!timedout) && read == 0) {
+ if (keycount > 0) { //only read if we were registered for a read
+ int cnt = socket.read(buf);
+ if (cnt == -1)
+ throw new EOFException();
+ read += cnt;
+ if (cnt > 0)
+ break;
+ }
+ KeyAttachment att = (KeyAttachment) key.attachment();
+ try {
+ if ( att.getLatch()==null || att.getLatch().getCount()==0) att.startLatch(1);
+ if ( att.interestOps() == 0) socket.getPoller().add(socket,SelectionKey.OP_READ);
+ att.getLatch().await(readTimeout,TimeUnit.MILLISECONDS);
+ }catch (InterruptedException ignore) {
+ Thread.interrupted();
+ }
+ if ( att.getLatch()!=null && att.getLatch().getCount()> 0) {
+ //we got interrupted, but we haven't received notification from the poller.
+ keycount = 0;
+ }else {
+ //latch countdown has happened
+ keycount = 1;
+ att.resetLatch();
+ }
+ if (readTimeout > 0 && (keycount == 0))
+ timedout = (System.currentTimeMillis() - time) >= readTimeout;
+ } //while
+ if (timedout)
+ throw new SocketTimeoutException();
+ } finally {
+ if (timedout && key != null) {
+ cancelKey(socket,key);
+ }
+ }
+ return read;
+ }
+
}
Propchange: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioBlockingSelector.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioSelectorPool.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioSelectorPool.java?view=diff&rev=531303&r1=531302&r2=531303
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioSelectorPool.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioSelectorPool.java Sun Apr 22 17:24:01 2007
@@ -1,17 +1,18 @@
/*
- * Copyright 2005-2006 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
+ * 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.
+ * 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;
Propchange: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/NioSelectorPool.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java?view=diff&rev=531303&r1=531302&r2=531303
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java Sun Apr 22 17:24:01 2007
@@ -1,3 +1,19 @@
+/*
+ * 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.io.IOException;
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?view=diff&rev=531303&r1=531302&r2=531303
==============================================================================
--- 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 Sun Apr 22 17:24:01 2007
@@ -1,353 +1,354 @@
-/*
- * Copyright 2005-2006 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.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;
- 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 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 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;
+ 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 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 setDirectBufferPool(int directBufferPool) {
+ this.bufferPool = directBufferPool;
+ }
+
}
Modified: tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/res/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/res/LocalStrings.properties?view=diff&rev=531303&r1=531302&r2=531303
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/res/LocalStrings.properties (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/tomcat/util/net/res/LocalStrings.properties Sun Apr 22 17:24:01 2007
@@ -18,6 +18,7 @@
endpoint.poll.limitedpollsize=Failed to create poller with specified size of {0}
endpoint.poll.initfail=Poller creation failed
endpoint.poll.fail=Critical poller failure (restarting poller): [{0}] {1}
+endpoint.poll.fail=Socket [{0}] poll event: [{1}] {2}
endpoint.poll.error=Unexpected poller error
endpoint.process.fail=Error allocating socket processor
endpoint.sendfile.error=Unexpected sendfile error
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
|