You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2011/06/23 08:36:11 UTC

svn commit: r1138745 - in /commons/sandbox/runtime/trunk/src/main: java/org/apache/commons/runtime/net/ native/os/unix/

Author: mturk
Date: Thu Jun 23 06:36:10 2011
New Revision: 1138745

URL: http://svn.apache.org/viewvc?rev=1138745&view=rev
Log:
PosixSelector will implement select() instead poll()

Added:
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/PollSelector.java
      - copied, changed from r1135690, commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/PosixSelector.java
Removed:
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/PosixSelector.java
Modified:
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/LocalSelectorFactory.java
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/SocketSelectorFactory.java
    commons/sandbox/runtime/trunk/src/main/native/os/unix/pollset.c

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/LocalSelectorFactory.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/LocalSelectorFactory.java?rev=1138745&r1=1138744&r2=1138745&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/LocalSelectorFactory.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/LocalSelectorFactory.java Thu Jun 23 06:36:10 2011
@@ -58,8 +58,8 @@ final class LocalSelectorFactory
         if (size < 1 || size > MAX_CAPACITY)
             throw new InvalidRangeException(Local.sm.get("selector.ERANGE"));
         switch (type) {
-            case 0:
-                return new PosixSelector(size);
+            case 1:
+                return new PollSelector(size);
             default:
                 throw new RuntimeException(Local.sm.get("selector.ETYPE"));
         }

Copied: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/PollSelector.java (from r1135690, commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/PosixSelector.java)
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/PollSelector.java?p2=commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/PollSelector.java&p1=commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/PosixSelector.java&r1=1135690&r2=1138745&rev=1138745&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/PosixSelector.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/PollSelector.java Thu Jun 23 06:36:10 2011
@@ -32,12 +32,12 @@ import org.apache.commons.runtime.Errno;
 import org.apache.commons.runtime.Status;
 
 /**
- * Posix socket selector implementation class.
- * PosixSelector uses posix poll() function for waiting on I/O events.
+ * Poll socket selector implementation class.
+ * PollSelector uses posix poll() function for waiting on I/O events.
  *
  * @since Runtime 1.0
  */
-final class PosixSelector extends AbstractSelector
+final class PollSelector extends AbstractSelector
 {
 
     private short[]                     revents;
@@ -60,7 +60,7 @@ final class PosixSelector extends Abstra
     /*
      * Created from native
      */
-    public PosixSelector(int size)
+    public PollSelector(int size)
     {
         super(size);
         pollset  = create0(size);

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/SocketSelectorFactory.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/SocketSelectorFactory.java?rev=1138745&r1=1138744&r2=1138745&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/SocketSelectorFactory.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/SocketSelectorFactory.java Thu Jun 23 06:36:10 2011
@@ -60,7 +60,7 @@ final class SocketSelectorFactory
         switch (type) {
             case 0:     // Posix select
             case 1:     // Posix poll
-                return new PosixSelector(size);
+                return new PollSelector(size);
             case 2:     // Linux epoll
             case 3:     // Solaris /dev/poll
             case 4:     // BSD Kqueue

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/pollset.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/pollset.c?rev=1138745&r1=1138744&r2=1138745&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/pollset.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/pollset.c Thu Jun 23 06:36:10 2011
@@ -85,7 +85,7 @@ static short reventt(short event)
     return rv;
 }
 
-ACR_NET_EXPORT(jlong, PosixSelector, create0)(JNI_STDARGS, jint size)
+ACR_NET_EXPORT(jlong, PollSelector, create0)(JNI_STDARGS, jint size)
 {
     int rc;
     acr_pollset_t *ps;
@@ -137,7 +137,7 @@ cleanup:
     return 0;
 }
 
-ACR_NET_EXPORT(int, PosixSelector, destroy0)(JNI_STDARGS, jlong pollset)
+ACR_NET_EXPORT(int, PollSelector, destroy0)(JNI_STDARGS, jlong pollset)
 {
     int i;
     int rc = 0;
@@ -178,8 +178,8 @@ ACR_NET_EXPORT(int, PosixSelector, destr
     return rc;
 }
 
-ACR_NET_EXPORT(jint, PosixSelector, clr0)(JNI_STDARGS, jlong pollset,
-                                          jobjectArray rs)
+ACR_NET_EXPORT(jint, PollSelector, clr0)(JNI_STDARGS, jlong pollset,
+                                         jobjectArray rs)
 {
     int i;
     int cnt = 0;
@@ -217,7 +217,7 @@ ACR_NET_EXPORT(jint, PosixSelector, clr0
     return cnt;
 }
 
-ACR_NET_EXPORT(void, PosixSelector, wakeup0)(JNI_STDARGS, jlong pollset)
+ACR_NET_EXPORT(void, PollSelector, wakeup0)(JNI_STDARGS, jlong pollset)
 {
     acr_pollset_t *ps = J2P(pollset, acr_pollset_t *);
 
@@ -230,7 +230,7 @@ ACR_NET_EXPORT(void, PosixSelector, wake
     pthread_mutex_unlock(&ps->mutex);
 }
 
-ACR_NET_EXPORT(jint, PosixSelector, size0)(JNI_STDARGS, jlong pollset)
+ACR_NET_EXPORT(jint, PollSelector, size0)(JNI_STDARGS, jlong pollset)
 {
     int rv;
     acr_pollset_t *ps = J2P(pollset, acr_pollset_t *);
@@ -241,9 +241,9 @@ ACR_NET_EXPORT(jint, PosixSelector, size
     return rv;
 }
 
-ACR_NET_EXPORT(jint, PosixSelector, wait0)(JNI_STDARGS, jlong pollset,
-                                           jobjectArray rs, jshortArray revents,
-                                           jint timeout, jboolean autocancel)
+ACR_NET_EXPORT(jint, PollSelector, wait0)(JNI_STDARGS, jlong pollset,
+                                          jobjectArray rs, jshortArray revents,
+                                          jint timeout, jboolean autocancel)
 {
     int i, ns, rc = 0;
     int rv = 0;
@@ -398,8 +398,8 @@ ACR_NET_EXPORT(jint, PosixSelector, wait
     return rv;
 }
 
-ACR_NET_EXPORT(jint, PosixSelector, add0)(JNI_STDARGS, jlong pollset, jobject fo,
-                                          jlong fp, jint events, jint ttlms)
+ACR_NET_EXPORT(jint, PollSelector, add0)(JNI_STDARGS, jlong pollset, jobject fo,
+                                         jlong fp, jint events, jint ttlms)
 {
     int i, rc = 0;
     acr_pollset_t *ps = J2P(pollset, acr_pollset_t *);
@@ -458,7 +458,7 @@ cleanup:
     return rc;
 }
 
-ACR_NET_EXPORT(jint, PosixSelector, del0)(JNI_STDARGS, jlong pollset,
+ACR_NET_EXPORT(jint, PollSelector, del0)(JNI_STDARGS, jlong pollset,
                                           jobject fo, jlong fp)
 {
     int i, rc = ACR_EOF;