You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by mh...@apache.org on 2007/01/21 02:29:21 UTC

svn commit: r498232 - /mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/

Author: mheath
Date: Sat Jan 20 17:29:20 2007
New Revision: 498232

URL: http://svn.apache.org/viewvc?view=rev&rev=498232
Log:
Consolodated future interfaces into AioFuture.

Removed:
    mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioBatchFuture.java
    mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioByteBufferFuture.java
    mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioLockFuture.java
    mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioOpenFuture.java
    mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioSyncFuture.java
    mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/TruncateFuture.java
Modified:
    mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioFuture.java
    mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AsynchronousFileChannel.java
    mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AsynchronousFileChannelFactory.java
    mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AsynchronousFileChannelProvider.java

Modified: mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioFuture.java
URL: http://svn.apache.org/viewvc/mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioFuture.java?view=diff&rev=498232&r1=498231&r2=498232
==============================================================================
--- mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioFuture.java (original)
+++ mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioFuture.java Sat Jan 20 17:29:20 2007
@@ -19,11 +19,26 @@
  */
 package org.apache.aio;
 
+import java.nio.channels.FileLock;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 
 public interface AioFuture<V, F extends AioFuture> extends Future<V> {
+    
+    static interface BatchFuture extends AioFuture<Long, BatchFuture> {
+        ByteBufferPosition[] getBatch();
+    }
 
+    static interface ByteBufferFuture extends AioFuture<Integer, ByteBufferFuture>, ByteBufferPosition {}
+    
+    static interface LockFuture extends AioFuture<FileLock, LockFuture> {}
+    
+    static interface OpenFuture extends AioFuture<AsynchronousFileChannel, OpenFuture> {}
+    
+    static interface SyncFuture extends AioFuture<Void, SyncFuture> {}
+    
+    static interface TruncateFuture extends AioFuture<Void, TruncateFuture> {}
+    
     void addCompletionHandler(AioCompletionHandler<F> completionHandler);
 
     void removeCompletionHandler(AioCompletionHandler<F> completionHandler);

Modified: mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AsynchronousFileChannel.java
URL: http://svn.apache.org/viewvc/mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AsynchronousFileChannel.java?view=diff&rev=498232&r1=498231&r2=498232
==============================================================================
--- mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AsynchronousFileChannel.java (original)
+++ mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AsynchronousFileChannel.java Sat Jan 20 17:29:20 2007
@@ -24,6 +24,12 @@
 import java.nio.channels.FileLock;
 import java.util.concurrent.ExecutionException;
 
+import org.apache.aio.AioFuture.BatchFuture;
+import org.apache.aio.AioFuture.ByteBufferFuture;
+import org.apache.aio.AioFuture.LockFuture;
+import org.apache.aio.AioFuture.SyncFuture;
+import org.apache.aio.AioFuture.TruncateFuture;
+
 /**
  * A channel for reading, writing and manipulating a file in an asynchronous manner.
  * 
@@ -82,33 +88,33 @@
      * 
      * @return A <tt>AioLockFuture</tt> object representing the pending result.
      */
-    public AioLockFuture lock() {
+    public LockFuture lock() {
         return lock(0L, Long.MAX_VALUE, false);
     }
 
-    public abstract AioLockFuture lock(long position, long size, boolean shared);
+    public abstract LockFuture lock(long position, long size, boolean shared);
 
     public abstract FileLock tryLock();
 
     public abstract FileLock tryLock(long position, long size, boolean shared);
 
-    public abstract AioSyncFuture sync();
+    public abstract SyncFuture sync();
 
-    public abstract AioByteBufferFuture read(ByteBuffer buffer, long position);
+    public abstract ByteBufferFuture read(ByteBuffer buffer, long position);
 
-    public AioBatchFuture read(ByteBufferPosition... byteBufferPositions) {
+    public BatchFuture read(ByteBufferPosition... byteBufferPositions) {
         return read(byteBufferPositions, 0, byteBufferPositions.length);
     }
 
-    public abstract AioBatchFuture read(ByteBufferPosition[] byteBufferPositions, int offset, int length);
+    public abstract BatchFuture read(ByteBufferPosition[] byteBufferPositions, int offset, int length);
 
-    public abstract AioByteBufferFuture write(ByteBuffer buffer, long position);
+    public abstract ByteBufferFuture write(ByteBuffer buffer, long position);
 
-    public AioBatchFuture write(ByteBufferPosition... byteBufferPositions) {
+    public BatchFuture write(ByteBufferPosition... byteBufferPositions) {
         return write(byteBufferPositions, 0, byteBufferPositions.length);
     }
 
-    public abstract AioBatchFuture write(ByteBufferPosition[] byteBufferPositions, int offset, int length);
+    public abstract BatchFuture write(ByteBufferPosition[] byteBufferPositions, int offset, int length);
 
     public static void suspend(AioFuture... futures) throws InterruptedException, ExecutionException {
         for (AioFuture future : futures) {

Modified: mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AsynchronousFileChannelFactory.java
URL: http://svn.apache.org/viewvc/mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AsynchronousFileChannelFactory.java?view=diff&rev=498232&r1=498231&r2=498232
==============================================================================
--- mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AsynchronousFileChannelFactory.java (original)
+++ mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AsynchronousFileChannelFactory.java Sat Jan 20 17:29:20 2007
@@ -23,6 +23,7 @@
 import java.util.Properties;
 import java.util.concurrent.ExecutorService;
 
+import org.apache.aio.AioFuture.OpenFuture;
 import org.apache.aio.concurrent.ConcurrentAsynchronousFileChannelProvider;
 import org.apache.aio.posix.PosixAsynchronousFileChannelProvider;
 
@@ -43,16 +44,16 @@
         return ConcurrentAsynchronousFileChannelProvider.class.getName();
     }
 
-    public static AioOpenFuture open(String fileName, EnumSet<Flags> flags) {
+    public static OpenFuture open(String fileName, EnumSet<Flags> flags) {
         return open(fileName, flags, null);
     }
     
-    public static AioOpenFuture open(String fileName, EnumSet<Flags> flags, ExecutorService executorService) {
+    public static OpenFuture open(String fileName, EnumSet<Flags> flags, ExecutorService executorService) {
         return open(fileName, flags, executorService, System.getProperties());
     }
 
     @SuppressWarnings("unchecked")
-    public static AioOpenFuture open(final String fileName, final EnumSet<Flags> flags, ExecutorService executorService, final Properties properties) {
+    public static OpenFuture open(final String fileName, final EnumSet<Flags> flags, ExecutorService executorService, final Properties properties) {
         String systemProvider = System.getProperty(
                 PROPERTY_ASYNCHRONOUS_FILE_CHANNEL_PROVIDER,
                 asynchronousFileChannelProvider);

Modified: mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AsynchronousFileChannelProvider.java
URL: http://svn.apache.org/viewvc/mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AsynchronousFileChannelProvider.java?view=diff&rev=498232&r1=498231&r2=498232
==============================================================================
--- mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AsynchronousFileChannelProvider.java (original)
+++ mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AsynchronousFileChannelProvider.java Sat Jan 20 17:29:20 2007
@@ -23,6 +23,8 @@
 import java.util.Properties;
 import java.util.concurrent.ExecutorService;
 
+import org.apache.aio.AioFuture.OpenFuture;
+
 public interface AsynchronousFileChannelProvider {
 
     /**
@@ -33,6 +35,6 @@
      * @param properties
      * @return
      */
-    public AioOpenFuture open(final String fileName, final EnumSet<Flags> flags, ExecutorService executorService, final Properties properties);
+    public OpenFuture open(final String fileName, final EnumSet<Flags> flags, ExecutorService executorService, final Properties properties);
     
 }