harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r587508 [4/4] - in /harmony/enhanced/classlib/trunk/modules/nio/src/main/java: common/java/nio/ common/java/nio/channels/ common/java/nio/channels/spi/ common/org/apache/harmony/nio/ common/org/apache/harmony/nio/internal/ unix/org/apache/h...
Date Tue, 23 Oct 2007 13:54:40 GMT
Modified: harmony/enhanced/classlib/trunk/modules/nio/src/main/java/unix/org/apache/harmony/nio/internal/EpollSelectorImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/unix/org/apache/harmony/nio/internal/EpollSelectorImpl.java?rev=587508&r1=587507&r2=587508&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/nio/src/main/java/unix/org/apache/harmony/nio/internal/EpollSelectorImpl.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/nio/src/main/java/unix/org/apache/harmony/nio/internal/EpollSelectorImpl.java
Tue Oct 23 06:54:37 2007
@@ -65,9 +65,9 @@
     final Object keysLock = new Object();
 
     boolean keySetChanged = true;
-    
+
     private SelectionKey[] keys = new SelectionKey[1];
-    
+
     private final Set<SelectionKey> keysSet = new HashSet<SelectionKey>();
 
     private Set<SelectionKey> unmodifiableKeys = Collections
@@ -82,33 +82,34 @@
     private Pipe.SinkChannel sink;
 
     private Pipe.SourceChannel source;
-    
+
     private FileDescriptor sourcefd;
-    
+
     private int[] keyFDs;
 
     private int[] readyFDs;
 
     private int[] readyOps;
-    
-	private int keysCount = 0;
+
+    private int keysCount = 0;
 
     private long epollFD;
-    
+
     private int countReady;
-   
+
     public Class fileDescriptorClass;
-    
+
     static native int resolveFD(Class cfd, FileDescriptor ofd);
-    
+
     static native long prepare();
 
     static native long addFileDescriptor(long epollFD, int mode, int fd);
 
     static native long delFileDescriptor(long epollFD, long fd);
 
-    static native int epoll(long epollFD, int count, int[] FDs, int[] ops, long timeout);
-  
+    static native int epoll(long epollFD, int count, int[] FDs, int[] ops,
+            long timeout);
+
     private InternalKeyMap<EpollSelectionKeyImpl> quickMap = new InternalKeyMap<EpollSelectionKeyImpl>();
 
     public EpollSelectorImpl(SelectorProvider selectorProvider) {
@@ -117,25 +118,25 @@
             Pipe mockSelector = selectorProvider.openPipe();
             sink = mockSelector.sink();
             source = mockSelector.source();
-            sourcefd = ((FileDescriptorHandler)source).getFD();
+            sourcefd = ((FileDescriptorHandler) source).getFD();
             source.configureBlocking(false);
-                        
+
             fileDescriptorClass = sourcefd.getClass();
-            
+
             keyFDs = new int[1];
             readyFDs = new int[1];
             readyOps = new int[1];
-            
+
             // register sink channel
             keyFDs[0] = resolveFD(fileDescriptorClass, sourcefd);
             keys[0] = source.keyFor(this);
             epollFD = prepare();
-            
+
             keysCount = 1;
 
-	    quickMap.put(keyFDs[0], (EpollSelectionKeyImpl)keys[0]);
+            quickMap.put(keyFDs[0], (EpollSelectionKeyImpl) keys[0]);
             addFileDescriptor(epollFD, 1, keyFDs[0]);
-            
+
         } catch (IOException e) {
             // do nothing
         }
@@ -149,9 +150,9 @@
             synchronized (keysSet) {
                 synchronized (selectedKeys) {
                     doCancel();
-                    for(int c = 0; c < keysCount; c++) {
+                    for (int c = 0; c < keysCount; c++) {
                         if (keys[c] != null) {
-                    	    deregister((AbstractSelectionKey) keys[c]);
+                            deregister((AbstractSelectionKey) keys[c]);
                         }
                     }
                     wakeup();
@@ -162,92 +163,104 @@
 
     private void ensureCapacity(int c) {
         // TODO: rewrite array handling as some internal class
-    	if(c >= keys.length) {
-    		SelectionKey[] t = new SelectionKey[(keys.length + 1) << 1];
-    		System.arraycopy(keys, 0, t, 0, keys.length);
-    		keys = t;           		            	
-    	}
+        if (c >= keys.length) {
+            SelectionKey[] t = new SelectionKey[(keys.length + 1) << 1];
+            System.arraycopy(keys, 0, t, 0, keys.length);
+            keys = t;
+        }
 
-        if(c >= readyFDs.length) {
+        if (c >= readyFDs.length) {
             int[] t = new int[(readyFDs.length + 1) << 1];
             System.arraycopy(readyFDs, 0, t, 0, readyFDs.length);
             readyFDs = t;
         }
-        
-		if (c >= keyFDs.length) {
-			int[] t = new int[(keyFDs.length + 1) << 1];
-			System.arraycopy(keyFDs, 0, t, 0, keyFDs.length);
-			keyFDs = t;            		
-		}
+
+        if (c >= keyFDs.length) {
+            int[] t = new int[(keyFDs.length + 1) << 1];
+            System.arraycopy(keyFDs, 0, t, 0, keyFDs.length);
+            keyFDs = t;
+        }
 
         if (c >= readyOps.length) {
             int[] t = new int[(readyOps.length + 1) << 1];
             System.arraycopy(readyOps, 0, t, 0, readyOps.length);
             readyOps = t;
         }
-    }		
-    
+    }
+
     private void limitCapacity() {
-    	// TODO: implement array squeezing
+        // TODO: implement array squeezing
     }
 
     /**
      * Adds the specified key to storage and updates the indexes accordingly
-     * @param sk key to add
+     * 
+     * @param sk
+     *            key to add
      * @return index in the storage
      */
     private int addKey(SelectionKey sk) {
-    	
-        // make sure that enough space is available    
+
+        // make sure that enough space is available
         ensureCapacity(keysCount);
-    	
+
         // get channel params
-    	int ops = sk.interestOps();
-    	int fd = resolveFD(fileDescriptorClass, ((FileDescriptorHandler) sk.channel()).getFD());
-    
+        int ops = sk.interestOps();
+        int fd = resolveFD(fileDescriptorClass, ((FileDescriptorHandler) sk
+                .channel()).getFD());
+
         int eops = 0;
-        if (((SelectionKey.OP_READ | SelectionKey.OP_ACCEPT) & ops) != 0) { eops = eops
+ READABLE; };
-        if (((SelectionKey.OP_WRITE | SelectionKey.OP_CONNECT) & ops) != 0) { eops =
eops + WRITABLE; };
-       
+        if (((SelectionKey.OP_READ | SelectionKey.OP_ACCEPT) & ops) != 0) {
+            eops = eops + READABLE;
+        }
+        ;
+        if (((SelectionKey.OP_WRITE | SelectionKey.OP_CONNECT) & ops) != 0) {
+            eops = eops + WRITABLE;
+        }
+        ;
+
         keys[keysCount] = sk;
         keyFDs[keysCount] = fd;
-    
-        quickMap.put(fd, (EpollSelectionKeyImpl)sk); 
+
+        quickMap.put(fd, (EpollSelectionKeyImpl) sk);
         addFileDescriptor(epollFD, eops, fd);
-        
-    	return keysCount++;
+
+        return keysCount++;
     }
-   
+
     /**
-     * Deletes the key from the internal storage and updates the indexes accordingly
-     * @param sk key to delete
+     * Deletes the key from the internal storage and updates the indexes
+     * accordingly
+     * 
+     * @param sk
+     *            key to delete
      */
     private void delKey(SelectionKey sk) {
-    	
+
         // get the key index in the internal storage
-        int index = ((EpollSelectionKeyImpl)sk).getIndex();                	            
   	                
+        int index = ((EpollSelectionKeyImpl) sk).getIndex();
 
-        // deregister FD in native 
+        // deregister FD in native
         delFileDescriptor(epollFD, keyFDs[index]);
-       
-	if ( quickMap.remove(keyFDs[index]) == null ) {
-		throw new RuntimeException();
-	}  
-    	// key is null now
-    	keys[index] = null;
-    	                	                	
+
+        if (quickMap.remove(keyFDs[index]) == null) {
+            throw new RuntimeException();
+        }
+        // key is null now
+        keys[index] = null;
+
         // key compaction to ensure lack of holes
         // we can simply exchange latest and current keys
-		if (keys[keysCount-1] != null) {       
-			keys[index] = keys[keysCount-1];
-			keys[keysCount-1] = null;            			            			
-	
-            keyFDs[index] = keyFDs[keysCount-1];
-            keyFDs[keysCount-1] = -1;
-            
-			// update key index
-			((EpollSelectionKeyImpl)keys[index]).setIndex(index);
-		}                                 		            		
+        if (keys[keysCount - 1] != null) {
+            keys[index] = keys[keysCount - 1];
+            keys[keysCount - 1] = null;
+
+            keyFDs[index] = keyFDs[keysCount - 1];
+            keyFDs[keysCount - 1] = -1;
+
+            // update key index
+            ((EpollSelectionKeyImpl) keys[index]).setIndex(index);
+        }
         keysCount--;
     }
 
@@ -256,13 +269,13 @@
      * @param sk
      */
     void modKey(SelectionKey sk) {
-    	// TODO: update indexes rather than recreate the key
-        synchronized(keysSet) {
+        // TODO: update indexes rather than recreate the key
+        synchronized (keysSet) {
             delKey(sk);
-    	    addKey(sk);
+            addKey(sk);
         }
     }
-    
+
     /*
      * @see java.nio.channels.spi.AbstractSelector#register(java.nio.channels.spi.AbstractSelectableChannel,
      *      int, java.lang.Object)
@@ -275,14 +288,16 @@
         synchronized (this) {
             synchronized (keysSet) {
 
-//		System.out.println("Registering channel");
-        		// create the key
-                SelectionKey sk = new EpollSelectionKeyImpl(channel, operations, attachment,
this);
-               
-    	        int index = addKey(sk);
-    	        ((EpollSelectionKeyImpl)sk).setIndex(index);
-                
-//		System.out.println(" channel registered with index = " + index);
+                // System.out.println("Registering channel");
+                // create the key
+                SelectionKey sk = new EpollSelectionKeyImpl(channel,
+                        operations, attachment, this);
+
+                int index = addKey(sk);
+                ((EpollSelectionKeyImpl) sk).setIndex(index);
+
+                // System.out.println(" channel registered with index = " +
+                // index);
                 return sk;
             }
         }
@@ -293,17 +308,17 @@
      */
     public synchronized Set<SelectionKey> keys() {
         closeCheck();
-        
+
         keysSet.clear();
-                
-		if (keys.length != keysCount) {
-			SelectionKey[] chompedKeys = new SelectionKey[keysCount];
-			System.arraycopy(keys, 0, chompedKeys, 0, keysCount);
-			keysSet.addAll(Arrays.asList(chompedKeys));
-		} else {
-			keysSet.addAll(Arrays.asList(keys));		
-		}
-		
+
+        if (keys.length != keysCount) {
+            SelectionKey[] chompedKeys = new SelectionKey[keysCount];
+            System.arraycopy(keys, 0, chompedKeys, 0, keysCount);
+            keysSet.addAll(Arrays.asList(chompedKeys));
+        } else {
+            keysSet.addAll(Arrays.asList(keys));
+        }
+
         keysSet.remove(source.keyFor(this));
         return unmodifiableKeys;
     }
@@ -349,15 +364,19 @@
                         if (isBlock) {
                             begin();
                         }
-//			System.out.println("calling native epoll(): keysCount = "  + keysCount + ", readyFDs.length
= " + readyFDs.length + ", readyOps.length = " + readyOps.length);
-                        countReady = epoll(epollFD, keysCount, readyFDs, readyOps, timeout);
-//			System.out.println(" returns " + countReady);
+                        // System.out.println("calling native epoll(): keysCount
+                        // = " + keysCount + ", readyFDs.length = " +
+                        // readyFDs.length + ", readyOps.length = " +
+                        // readyOps.length);
+                        countReady = epoll(epollFD, keysCount, readyFDs,
+                                readyOps, timeout);
+                        // System.out.println(" returns " + countReady);
                     } finally {
                         if (isBlock) {
                             end();
                         }
                     }
-                    return processSelectResult();                    
+                    return processSelectResult();
                 }
             }
         }
@@ -393,50 +412,52 @@
             }
         }
         int selected = 0;
-                       
+
         EpollSelectionKeyImpl key = null;
         for (int i = 0; i < countReady; i++) {
 
-//		System.out.println("processSelectResults(): mapping readyFDs[" + i + "]");
-                // Lookup the key, map the index in readyFDs to real key
-                key = (EpollSelectionKeyImpl)quickMap.get(readyFDs[i]);
-                
-		if (null == key) {
-			continue;
-		}
-//	        System.out.println(" ready key = " + key.getIndex());			
-
-		int ops = key.interestOps();
-		int selectedOp = 0;
-			
-                if ( (readyOps[i] & READABLE) != 0 ) {
-                    selectedOp = (SelectionKey.OP_READ | SelectionKey.OP_ACCEPT) & ops;
-                }
-                
-                if ( (readyOps[i] & WRITABLE) != 0 ) {
-                     if (isConnected(key)) {
-                        selectedOp = selectedOp | (SelectionKey.OP_WRITE & ops);
-                     } else {
-                        selectedOp = selectedOp | (SelectionKey.OP_CONNECT & ops);
-                     } 
+            // System.out.println("processSelectResults(): mapping readyFDs[" +
+            // i + "]");
+            // Lookup the key, map the index in readyFDs to real key
+            key = (EpollSelectionKeyImpl) quickMap.get(readyFDs[i]);
+
+            if (null == key) {
+                continue;
+            }
+            // System.out.println(" ready key = " + key.getIndex());
+
+            int ops = key.interestOps();
+            int selectedOp = 0;
+
+            if ((readyOps[i] & READABLE) != 0) {
+                selectedOp = (SelectionKey.OP_READ | SelectionKey.OP_ACCEPT)
+                        & ops;
+            }
+
+            if ((readyOps[i] & WRITABLE) != 0) {
+                if (isConnected(key)) {
+                    selectedOp = selectedOp | (SelectionKey.OP_WRITE & ops);
+                } else {
+                    selectedOp = selectedOp | (SelectionKey.OP_CONNECT & ops);
                 }
+            }
 
-		if (0 != selectedOp) {
-			if (selectedKeys.contains(key)) {
-                		if (key.readyOps() != selectedOp) {
-					key.setReadyOps(key.readyOps() | selectedOp);
-    					selected++;
-				}
-			} else {
-				key.setReadyOps(selectedOp);
-				selectedKeys.add(key);
-				selected++;
-			}
-		}
+            if (0 != selectedOp) {
+                if (selectedKeys.contains(key)) {
+                    if (key.readyOps() != selectedOp) {
+                        key.setReadyOps(key.readyOps() | selectedOp);
+                        selected++;
+                    }
+                } else {
+                    key.setReadyOps(selectedOp);
+                    selectedKeys.add(key);
+                    selected++;
+                }
+            }
 
-		}
+        }
 
-//	System.out.println("processSelectResult(): selected = " + selected);
+        // System.out.println("processSelectResult(): selected = " + selected);
         return selected;
     }
 
@@ -452,9 +473,9 @@
         Set<SelectionKey> cancelledKeys = cancelledKeys();
         synchronized (cancelledKeys) {
             if (cancelledKeys.size() > 0) {
-                for (SelectionKey currentkey : cancelledKeys) {                	
-               	    delKey(currentkey);                	            		            	
-                    deregister((AbstractSelectionKey) currentkey);                      
                             		
+                for (SelectionKey currentkey : cancelledKeys) {
+                    delKey(currentkey);
+                    deregister((AbstractSelectionKey) currentkey);
                     selectedKeys.remove(currentkey);
                 }
             }
@@ -477,135 +498,144 @@
 
     private static class InternalKeyMap<E> {
 
-       Entry<E>[] storage; 
+        Entry<E>[] storage;
+
+        int size;
+
+        Entry deleted = new Entry(-1, null);
+
+        final int threshRatio = 4;
+
+        public InternalKeyMap() {
+            this(1);
+        }
+
+        public InternalKeyMap(int initialSize) {
+            storage = new Entry[initialSize];
+            size = 0;
+        }
+
+        private E putEntryNoCheck(Entry<E>[] storage, int key, Entry<E> entry)
{
+
+            for (int tryCount = 0; tryCount < storage.length; tryCount++) {
 
-       int size;
-      
-       Entry deleted = new Entry(-1, null); 
-       
-       final int threshRatio = 4;
-       
-       public InternalKeyMap() {
-           this(1);
-       }
-        
-       public InternalKeyMap(int initialSize) {
-           storage = new Entry[initialSize];
-           size = 0;
-       }
-        
-       private E putEntryNoCheck(Entry<E>[] storage, int key, Entry<E> entry)
{
-           
-          for(int tryCount = 0; tryCount < storage.length ; tryCount++) {
-              
-            int hash = hash(key, tryCount);
-            int index = hash % storage.length;
-
-//            System.out.println("put: hash: " + hash + ", index: " + index + ", key: " +
key + ", size: " + size + ", tryCount: " + tryCount + ", storage.length=" + storage.length);
-
-            if ( storage[index] == null ) {
-		    if ( entry != deleted ) {
-		       storage[index] = entry;
-		    }
+                int hash = hash(key, tryCount);
+                int index = hash % storage.length;
+
+                // System.out.println("put: hash: " + hash + ", index: " + index
+                // + ", key: " + key + ", size: " + size + ", tryCount: " +
+                // tryCount + ", storage.length=" + storage.length);
+
+                if (storage[index] == null) {
+                    if (entry != deleted) {
+                        storage[index] = entry;
+                    }
                     return null;
-            } else if ( storage[index].key == key || (storage[index] == deleted &&
entry != deleted) ) {
-	             E t = storage[index].value;
-                     storage[index] = entry;
-                     return t;
-	    }
-          }
-
-           throw new ArrayIndexOutOfBoundsException();    
-       }
-       
-       private E putEntry(int key, Entry<E> entry) {
-          if ( size >= storage.length || (storage.length / (storage.length - size)) >=
threshRatio) {
-               rehash();
-          }
-          
-	  E result = putEntryNoCheck(storage, key, entry);
-	  if (result == null) {
-		size++;
-	  } 
-
-	  return result;
-       }
-       
-       public void put(int key, E value) {
-           Entry<E> t = new Entry<E>(key, value);
-           putEntry(key, t);
-       }
-       
-       public E remove(int key) {
-	   E result = putEntryNoCheck(storage, key, deleted);
-	
-	   if (result != null) {
-		size--;
-	   }
-
-	   return result;
-       }
-       
-       public E get(int key) {
-	    if (storage == null) {
-//		System.out.println(" FAIL, storage=null");
-		return null;
-	    }
+                } else if (storage[index].key == key
+                        || (storage[index] == deleted && entry != deleted)) {
+                    E t = storage[index].value;
+                    storage[index] = entry;
+                    return t;
+                }
+            }
+
+            throw new ArrayIndexOutOfBoundsException();
+        }
+
+        private E putEntry(int key, Entry<E> entry) {
+            if (size >= storage.length
+                    || (storage.length / (storage.length - size)) >= threshRatio) {
+                rehash();
+            }
+
+            E result = putEntryNoCheck(storage, key, entry);
+            if (result == null) {
+                size++;
+            }
+
+            return result;
+        }
 
-            for(int tryCount = 0; tryCount < storage.length ; tryCount++) {
+        public void put(int key, E value) {
+            Entry<E> t = new Entry<E>(key, value);
+            putEntry(key, t);
+        }
+
+        public E remove(int key) {
+            E result = putEntryNoCheck(storage, key, deleted);
+
+            if (result != null) {
+                size--;
+            }
+
+            return result;
+        }
+
+        public E get(int key) {
+            if (storage == null) {
+                // System.out.println(" FAIL, storage=null");
+                return null;
+            }
+
+            for (int tryCount = 0; tryCount < storage.length; tryCount++) {
                 int hash = hash(key, tryCount);
                 int index = hash % storage.length;
 
-//            	System.out.println("get: hash: " + hash + ", index: " + index + ", key: "
+ key + ", size: " + size + ", tryCount: " + tryCount + ", storage.length=" + storage.length);
+                // System.out.println("get: hash: " + hash + ", index: " + index
+                // + ", key: " + key + ", size: " + size + ", tryCount: " +
+                // tryCount + ", storage.length=" + storage.length);
 
-                if ( storage[index] == null ) {
-//		    System.out.println("Lookup FAIL, reached end");
+                if (storage[index] == null) {
+                    // System.out.println("Lookup FAIL, reached end");
                     return null;
                 }
 
-                if ( storage[index].key == key ) {
-//		    System.out.println("Lookup OK!");
+                if (storage[index].key == key) {
+                    // System.out.println("Lookup OK!");
                     return storage[index].value;
                 }
 
-            }  
-//	    System.out.println(" FAIL, tryCount > storage.length");
+            }
+            // System.out.println(" FAIL, tryCount > storage.length");
             return null;
-       }
-       
-       private void rehash() {
+        }
+
+        private void rehash() {
             Entry<E>[] newStorage = new Entry[storage.length << 1];
             int newSize = 0;
-            for(int c = 0; c < storage.length; c++) {
-                if(storage[c] == null) continue;
-                if(storage[c] == deleted) continue;
+            for (int c = 0; c < storage.length; c++) {
+                if (storage[c] == null)
+                    continue;
+                if (storage[c] == deleted)
+                    continue;
                 putEntryNoCheck(newStorage, storage[c].key, storage[c]);
                 newSize++;
-            }     
+            }
             storage = newStorage;
             size = newSize;
-       }
-       
-       private int hash(int key, int tryCount) {
-           int t1 = key*31 + 1;
-           int t2 = 2*key + 1;
-           return (t1+(t2*tryCount)) & 0x7FFFFFFF;
-       }
-       
-       private static class Entry<E> {
-        
+        }
+
+        private int hash(int key, int tryCount) {
+            int t1 = key * 31 + 1;
+            int t2 = 2 * key + 1;
+            return (t1 + (t2 * tryCount)) & 0x7FFFFFFF;
+        }
+
+        private static class Entry<E> {
+
             final int key;
+
             final E value;
-           
+
             public Entry(int iKey, E iValue) {
                 key = iKey;
                 value = iValue;
-            } 
-            
-       }
-       
-    } 
-    
+            }
+
+        }
+
+    }
+
     private static class UnaddableSet<E> implements Set<E> {
 
         private Set<E> set;
@@ -674,7 +704,5 @@
             return set.toArray(a);
         }
     }
-    
 
 }
-

Modified: harmony/enhanced/classlib/trunk/modules/nio/src/main/java/unix/org/apache/harmony/nio/internal/EpollSelectorProviderImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/unix/org/apache/harmony/nio/internal/EpollSelectorProviderImpl.java?rev=587508&r1=587507&r2=587508&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/nio/src/main/java/unix/org/apache/harmony/nio/internal/EpollSelectorProviderImpl.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/nio/src/main/java/unix/org/apache/harmony/nio/internal/EpollSelectorProviderImpl.java
Tue Oct 23 06:54:37 2007
@@ -25,59 +25,57 @@
 import java.nio.channels.spi.AbstractSelector;
 import java.nio.channels.spi.SelectorProvider;
 
-
 /*
  * Internal implementation of SelectorProvider.
- * 
  */
 public class EpollSelectorProviderImpl extends SelectorProvider {
 
-	/*
-	 * Constructor for this class.
-	 */
-	public EpollSelectorProviderImpl() {
-		super();
-		System.out.println("Now using EpollSelectorProvider");
-	}
-
-	/*
-	 * 
-	 * @see java.nio.channels.spi.SelectorProvider#openDatagramChannel()
-	 */
-	public DatagramChannel openDatagramChannel() throws IOException {
-		return new DatagramChannelImpl(this);
-	}
-
-	/*
-	 * 
-	 * @see java.nio.channels.spi.SelectorProvider#openPipe()
-	 */
-	public Pipe openPipe() throws IOException {
-	    return new PipeImpl();
-	}
-
-	/*
-	 * 
-	 * @see java.nio.channels.spi.SelectorProvider#openSelector()
-	 */
-	public AbstractSelector openSelector() throws IOException {
+    /*
+     * Constructor for this class.
+     */
+    public EpollSelectorProviderImpl() {
+        super();
+        System.out.println("Now using EpollSelectorProvider");
+    }
+
+    /*
+     * 
+     * @see java.nio.channels.spi.SelectorProvider#openDatagramChannel()
+     */
+    public DatagramChannel openDatagramChannel() throws IOException {
+        return new DatagramChannelImpl(this);
+    }
+
+    /*
+     * 
+     * @see java.nio.channels.spi.SelectorProvider#openPipe()
+     */
+    public Pipe openPipe() throws IOException {
+        return new PipeImpl();
+    }
+
+    /*
+     * 
+     * @see java.nio.channels.spi.SelectorProvider#openSelector()
+     */
+    public AbstractSelector openSelector() throws IOException {
         return new EpollSelectorImpl(this);
     }
 
-	/*
-	 * 
-	 * @see java.nio.channels.spi.SelectorProvider#openServerSocketChannel()
-	 */
-	public ServerSocketChannel openServerSocketChannel() throws IOException {
-		return new ServerSocketChannelImpl(this);
-	}
-
-	/*
-	 * 
-	 * @see java.nio.channels.spi.SelectorProvider#openSocketChannel()
-	 */
-	public SocketChannel openSocketChannel() throws IOException {
-		return new SocketChannelImpl(this);
-	}
+    /*
+     * 
+     * @see java.nio.channels.spi.SelectorProvider#openServerSocketChannel()
+     */
+    public ServerSocketChannel openServerSocketChannel() throws IOException {
+        return new ServerSocketChannelImpl(this);
+    }
+
+    /*
+     * 
+     * @see java.nio.channels.spi.SelectorProvider#openSocketChannel()
+     */
+    public SocketChannel openSocketChannel() throws IOException {
+        return new SocketChannelImpl(this);
+    }
 
 }



Mime
View raw message