You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@apache.org on 2008/04/23 19:32:04 UTC

svn commit: r650947 - /tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/tomcat/util/net/SelectorPool.java

Author: costin
Date: Wed Apr 23 10:32:02 2008
New Revision: 650947

URL: http://svn.apache.org/viewvc?rev=650947&view=rev
Log:
Missed one file


Added:
    tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/tomcat/util/net/SelectorPool.java   (with props)

Added: tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/tomcat/util/net/SelectorPool.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/tomcat/util/net/SelectorPool.java?rev=650947&view=auto
==============================================================================
--- tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/tomcat/util/net/SelectorPool.java (added)
+++ tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/tomcat/util/net/SelectorPool.java Wed Apr 23 10:32:02 2008
@@ -0,0 +1,65 @@
+/*  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.util.concurrent.atomic.AtomicInteger;
+
+
+/**
+ * Support for multiple SelectorThreads. 
+ * 
+ * This is a placeholder, one thread only used right now to make it easier to 
+ * debug/test. For small servers one thread should be enough anyways, and 
+ * that's the first target for lite.
+ * 
+ * TODO: discover if APR is available and use it, or fall back to NIO. 
+ * 
+ * @author Costin Manolache
+ */
+public class SelectorPool {
+  // TODO: discover apr
+  // TODO: pool, balanced usage
+  static AtomicInteger id = new AtomicInteger();
+  int seq;
+  
+  SelectorThread selector;
+  private boolean daemon;
+  static SelectorPool defaultSPool = new SelectorPool();
+  
+  public SelectorPool() {
+    seq = id.incrementAndGet();
+  }
+  
+  public static SelectorPool defaultPool() {
+      return defaultSPool;
+  }
+  
+  public void stop() {
+      selector.stop();
+  }
+
+  public SelectorThread getSelector() {
+      if (selector == null) {
+          selector = new SelectorThreadNio(daemon);
+          ((SelectorThreadNio)selector).setName("SelectorThread-" + seq);    
+      }
+      return selector;
+  }
+
+  public void setDaemon(boolean daemon) {
+      this.daemon = daemon;
+  }  
+}

Propchange: tomcat/sandbox/tomcat-lite/coyote-extensions/org/apache/tomcat/util/net/SelectorPool.java
------------------------------------------------------------------------------
    svn:eol-style = native



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