commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r1129203 - in /commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime: net/AbstractSocketDescriptor.java net/LocalSocketDescriptor.java net/SelectionKey.java net/SocketDescriptor.java platform/unix/SocketSelectorImpl.java
Date Mon, 30 May 2011 14:48:41 GMT
Author: mturk
Date: Mon May 30 14:48:41 2011
New Revision: 1129203

URL: http://svn.apache.org/viewvc?rev=1129203&view=rev
Log:
Add abstract socket descriptor private class

Added:
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/AbstractSocketDescriptor.java
  (with props)
Modified:
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/LocalSocketDescriptor.java
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/SelectionKey.java
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/SocketDescriptor.java
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/SocketSelectorImpl.java

Added: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/AbstractSocketDescriptor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/AbstractSocketDescriptor.java?rev=1129203&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/AbstractSocketDescriptor.java
(added)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/AbstractSocketDescriptor.java
Mon May 30 14:48:41 2011
@@ -0,0 +1,48 @@
+/* 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.commons.runtime.net;
+
+import java.io.Closeable;
+import java.io.Flushable;
+import java.io.IOException;
+import java.io.SyncFailedException;
+import java.net.SocketException;
+import org.apache.commons.runtime.Status;
+import org.apache.commons.runtime.io.ClosedDescriptorException;
+import org.apache.commons.runtime.io.Descriptor;
+
+/**
+ * Package private abstract socket descriptor
+ * @since Runtime 1.0
+ */
+abstract class AbstractSocketDescriptor extends Descriptor
+{
+
+    protected boolean blocking  = false;
+    
+    protected AbstractSocketDescriptor()
+    {
+    }
+
+    @Override
+    public boolean isBlocking()
+        throws IOException
+    {
+        return blocking;
+    }
+
+}

Propchange: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/AbstractSocketDescriptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/LocalSocketDescriptor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/LocalSocketDescriptor.java?rev=1129203&r1=1129202&r2=1129203&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/LocalSocketDescriptor.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/LocalSocketDescriptor.java
Mon May 30 14:48:41 2011
@@ -33,11 +33,9 @@ import org.apache.commons.runtime.io.Des
  * </p>
  * @since Runtime 1.0
  */
-final class LocalSocketDescriptor extends Descriptor
+final class LocalSocketDescriptor extends AbstractSocketDescriptor
 {
 
-    private boolean blocking    = false;
-
     private static native int close0(int fd);
     private static native int sendz0(int fd);
     private static native int nonblock0(int fd, boolean block);
@@ -95,13 +93,6 @@ final class LocalSocketDescriptor extend
         return this;
     }
 
-    @Override
-    public boolean isBlocking()
-        throws IOException
-    {
-        return blocking;
-    }
-
     /**
      * Called by the garbage collector when the object is destroyed.
      * The class will free internal resources allocated by the Operating system.

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/SelectionKey.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/SelectionKey.java?rev=1129203&r1=1129202&r2=1129203&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/SelectionKey.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/SelectionKey.java
Mon May 30 14:48:41 2011
@@ -83,9 +83,9 @@ public abstract class SelectionKey
      * It is acceptable to attach {@code null}, this discards the
      * old attachment.
      *
-     * @param anObj
-     *          the object to attach, or {@code null} to discard the current
-     *          attachment.
+     * @param obj
+     *         the object to attach, or {@code null} to discard the current
+     *         attachment.
      * @return the last attached object or {@code null} if no object has been
      *         attached.
      */

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/SocketDescriptor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/SocketDescriptor.java?rev=1129203&r1=1129202&r2=1129203&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/SocketDescriptor.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/net/SocketDescriptor.java
Mon May 30 14:48:41 2011
@@ -29,11 +29,9 @@ import org.apache.commons.runtime.io.Des
  * Package private Socket Descriptor 
  * @since Runtime 1.0
  */
-final class SocketDescriptor extends Descriptor
+final class SocketDescriptor extends AbstractSocketDescriptor
 {
 
-    private boolean blocking    = false;
-
     private static native int close0(int fd);
     private static native int sendz0(int fd);
     private static native int nonblock0(int fd, boolean block);
@@ -92,13 +90,6 @@ final class SocketDescriptor extends Des
         return this;
     }
 
-    @Override
-    public boolean isBlocking()
-        throws IOException
-    {
-        return blocking;
-    }
-
     /**
      * Called by the garbage collector when the object is destroyed.
      * The class will free internal resources allocated by the Operating system.

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/SocketSelectorImpl.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/SocketSelectorImpl.java?rev=1129203&r1=1129202&r2=1129203&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/SocketSelectorImpl.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/unix/SocketSelectorImpl.java
Mon May 30 14:48:41 2011
@@ -20,6 +20,7 @@ import java.net.SocketException;
 import java.util.ArrayList;
 import java.util.HashSet;
 import org.apache.commons.runtime.io.ClosedDescriptorException;
+import org.apache.commons.runtime.io.Descriptor;
 import org.apache.commons.runtime.net.Endpoint;
 import org.apache.commons.runtime.net.ClosedSelectorException;
 import org.apache.commons.runtime.net.IllegalSelectorException;
@@ -108,7 +109,8 @@ final class SocketSelectorImpl extends S
         SelectionKeyImpl skey = (SelectionKeyImpl)key;
         if (skey.selector() != this)
             throw new IllegalSelectorException();
-        int fd  = skey.endpoint().descriptor().fd();
+        Descriptor sd = skey.endpoint().descriptor();
+        int fd  = sd.fd();
         if (fd == -1)
             throw new ClosedDescriptorException();
         int rc = add0(pollset, skey, fd, ops, skey.timeout());
@@ -132,7 +134,8 @@ final class SocketSelectorImpl extends S
         if (key.selector() != this)
             throw new IllegalSelectorException();
         SelectionKeyImpl skey = (SelectionKeyImpl)key;
-        int fd  = skey.endpoint().descriptor().fd();
+        Descriptor sd = skey.endpoint().descriptor();
+        int fd  = sd.fd();
         if (fd != -1) {
             // Remove selection key
             del0(pollset, skey, fd);



Mime
View raw message