harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ghar...@apache.org
Subject svn commit: r415988 - in /incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java: java/nio/channels/spi/ org/apache/harmony/nio/internal/
Date Wed, 21 Jun 2006 13:49:50 GMT
Author: gharley
Date: Wed Jun 21 06:49:48 2006
New Revision: 415988

URL: http://svn.apache.org/viewvc?rev=415988&view=rev
Log:
Remove unused imports and fix up use of generics. 

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/channels/spi/AbstractInterruptibleChannel.java
    incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/LockManager.java
    incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/MappedByteBufferFactory.java
    incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/WriteOnlyFileChannel.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/channels/spi/AbstractInterruptibleChannel.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/channels/spi/AbstractInterruptibleChannel.java?rev=415988&r1=415987&r2=415988&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/channels/spi/AbstractInterruptibleChannel.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/channels/spi/AbstractInterruptibleChannel.java
Wed Jun 21 06:49:48 2006
@@ -20,8 +20,6 @@
 import java.nio.channels.Channel;
 import java.nio.channels.ClosedByInterruptException;
 import java.nio.channels.InterruptibleChannel;
-import java.util.LinkedList;
-import java.util.List;
 
 /**
  * This class roots the implementation of interruptable channels.

Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/LockManager.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/LockManager.java?rev=415988&r1=415987&r2=415988&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/LockManager.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/LockManager.java
Wed Jun 21 06:49:48 2006
@@ -15,7 +15,6 @@
 
 package org.apache.harmony.nio.internal;
 
-
 import java.nio.channels.FileLock;
 import java.nio.channels.OverlappingFileLockException;
 import java.util.Comparator;
@@ -29,51 +28,52 @@
  * 
  */
 final class LockManager {
-	// The set of acquired and pending locks.
-	private final Comparator lockComparator = new Comparator() {
-		public int compare(Object lock1, Object lock2) {
-			long position1 = ((FileLock) lock1).position();
-			long position2 = ((FileLock) lock2).position();
-			return position1 > position2 ? 1 : (position1 < position2 ? -1 : 0);
-		}
-	};
-
-	private final SortedSet<FileLock> locks = new TreeSet(lockComparator);
-
-	/*
-	 * Default Constructor.
-	 */
-	protected LockManager() {
-		super();
-	}
-
-	/*
-	 * Add a new pending lock to the manager. Thows an exception if the lock
-	 * would overlap an existing lock. Once the lock is acquired it remains in
-	 * this set as an acquired lock.
-	 */
-	synchronized void addLock(FileLock lock)
-			throws OverlappingFileLockException {
-		long lockEnd = lock.position() + lock.size();
-		for (Iterator keyItr = locks.iterator(); keyItr.hasNext();) {
-			FileLock existingLock = (FileLock) keyItr.next();
-			if (existingLock.position() > lockEnd) {
-				// This, and all remaining locks, start beyond our end (so
-				// cannot overlap).
-				break;
-			}
-			if (existingLock.overlaps(lock.position(), lock.size())) {
-				throw new OverlappingFileLockException();
-			}
-		}
-		locks.add(lock);
-	}
-
-	/*
-	 * Removes an acquired lock from the lock manager. If the lock did not exist
-	 * in the lock manager the operation is a no-op.
-	 */
-	synchronized void removeLock(FileLock lock) {
-		locks.remove(lock);
-	}
+    // The set of acquired and pending locks.
+    private final Comparator<FileLock> lockComparator = new Comparator<FileLock>()
{
+        public int compare(FileLock lock1, FileLock lock2) {
+            long position1 = lock1.position();
+            long position2 = lock2.position();
+            return position1 > position2 ? 1 : (position1 < position2 ? -1 : 0);
+        }
+    };
+
+    private final SortedSet<FileLock> locks = new TreeSet<FileLock>(
+            lockComparator);
+
+    /*
+     * Default Constructor.
+     */
+    protected LockManager() {
+        super();
+    }
+
+    /*
+     * Add a new pending lock to the manager. Thows an exception if the lock
+     * would overlap an existing lock. Once the lock is acquired it remains in
+     * this set as an acquired lock.
+     */
+    synchronized void addLock(FileLock lock)
+            throws OverlappingFileLockException {
+        long lockEnd = lock.position() + lock.size();
+        for (Iterator<FileLock> keyItr = locks.iterator(); keyItr.hasNext();) {
+            FileLock existingLock = keyItr.next();
+            if (existingLock.position() > lockEnd) {
+                // This, and all remaining locks, start beyond our end (so
+                // cannot overlap).
+                break;
+            }
+            if (existingLock.overlaps(lock.position(), lock.size())) {
+                throw new OverlappingFileLockException();
+            }
+        }
+        locks.add(lock);
+    }
+
+    /*
+     * Removes an acquired lock from the lock manager. If the lock did not exist
+     * in the lock manager the operation is a no-op.
+     */
+    synchronized void removeLock(FileLock lock) {
+        locks.remove(lock);
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/MappedByteBufferFactory.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/MappedByteBufferFactory.java?rev=415988&r1=415987&r2=415988&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/MappedByteBufferFactory.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/MappedByteBufferFactory.java
Wed Jun 21 06:49:48 2006
@@ -28,7 +28,7 @@
 
 	static {
 		constructor = (Constructor) AccessController
-				.doPrivileged(new PrivilegedAction() {
+				.doPrivileged(new PrivilegedAction<Object>() {
 					public Object run() {
 						try {
 							Class wrapperClazz = ClassLoader

Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/WriteOnlyFileChannel.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/WriteOnlyFileChannel.java?rev=415988&r1=415987&r2=415988&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/WriteOnlyFileChannel.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/WriteOnlyFileChannel.java
Wed Jun 21 06:49:48 2006
@@ -20,7 +20,6 @@
 import java.nio.channels.FileLock;
 import java.nio.channels.NonReadableChannelException;
 import java.nio.channels.WritableByteChannel;
-import java.nio.channels.FileChannel.MapMode;
 
 public final class WriteOnlyFileChannel extends FileChannelImpl {
 



Mime
View raw message