changeset in /hg/icedtea6: Fix some sun.nio.ch classes.
Andrew John Hughes
gnu_andrew at member.fsf.org
Tue Feb 3 04:13:57 PST 2009
changeset dbdaa8e2cf1f in /hg/icedtea6
details: http://icedtea.classpath.org/hg/icedtea6?cmd=changeset;node=dbdaa8e2cf1f
description:
Fix some sun.nio.ch classes.
2009-01-14 Andrew John Hughes <gnu_andrew at member.fsf.org>
* overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/FileChannel.java:
Extend java.nio.channels.FileChannel to minimise code.
* overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/util/concurrent/ScheduledThreadPoolExecutor.java:
Adapted to use the SharedSecrets backdoor.
* overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/misc/JavaUtilConcurrentThreadPoolExecutorAccess.java:
Add remaining methods needed for our ScheduledThreadPoolExecutor.
* overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/AsynchronousChannelGroupImpl.java:
Create a ScheduledThreadPoolExecutor directly so ours is used.
* overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/AsynchronousFileChannelImpl.java:
Refer to AsynchronousFileLockImpl not FileLockImpl.
* overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/AsynchronousFileLockImpl.java,
* overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/FileLockTable.java:
Fix imports.
* patches/icedtea-nio2.patch:
Update implementation of secrets interface.
diffstat:
9 files changed, 86 insertions(+), 797 deletions(-)
ChangeLog | 18
overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/FileChannel.java | 774 ----------
overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/util/concurrent/ScheduledThreadPoolExecutor.java | 25
overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/misc/JavaUtilConcurrentThreadPoolExecutorAccess.java | 9
overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/AsynchronousChannelGroupImpl.java | 15
overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/AsynchronousFileChannelImpl.java | 17
overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/AsynchronousFileLockImpl.java | 2
overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/FileLockTable.java | 6
patches/icedtea-nio2.patch | 17
diffs (truncated from 1118 to 500 lines):
diff -r 9eb9c1670c99 -r dbdaa8e2cf1f ChangeLog
--- a/ChangeLog Wed Jan 14 05:29:15 2009 +0000
+++ b/ChangeLog Thu Jan 15 02:31:47 2009 +0000
@@ -1,3 +1,21 @@ 2009-01-13 Andrew John Hughes <gnu_and
+2009-01-14 Andrew John Hughes <gnu_andrew at member.fsf.org>
+
+ * overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/FileChannel.java:
+ Extend java.nio.channels.FileChannel to minimise code.
+ * overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/util/concurrent/ScheduledThreadPoolExecutor.java:
+ Adapted to use the SharedSecrets backdoor.
+ * overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/misc/JavaUtilConcurrentThreadPoolExecutorAccess.java:
+ Add remaining methods needed for our ScheduledThreadPoolExecutor.
+ * overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/AsynchronousChannelGroupImpl.java:
+ Create a ScheduledThreadPoolExecutor directly so ours is used.
+ * overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/AsynchronousFileChannelImpl.java:
+ Refer to AsynchronousFileLockImpl not FileLockImpl.
+ * overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/AsynchronousFileLockImpl.java,
+ * overlays/nio2/openjdk/jdk/src/share/classes/sun/nio/ch/FileLockTable.java:
+ Fix imports.
+ * patches/icedtea-nio2.patch:
+ Update implementation of secrets interface.
+
2009-01-13 Andrew John Hughes <gnu_andrew at member.fsf.org>
* overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/misc/JavaIODeleteOnExitAccess.java,
diff -r 9eb9c1670c99 -r dbdaa8e2cf1f overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/FileChannel.java
--- a/overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/FileChannel.java Wed Jan 14 05:29:15 2009 +0000
+++ b/overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/FileChannel.java Thu Jan 15 02:31:47 2009 +0000
@@ -162,8 +162,8 @@ import org.classpath.icedtea.java.nio.fi
*/
public abstract class FileChannel
- extends AbstractInterruptibleChannel
- implements SeekableByteChannel, GatheringByteChannel, ScatteringByteChannel
+ extends java.nio.channels.FileChannel
+ implements SeekableByteChannel
{
/**
* Initializes a new instance of this class.
@@ -288,9 +288,9 @@ public abstract class FileChannel
*
* @since 1.7
*/
- public static FileChannel open(Path file,
- Set<? extends OpenOption> options,
- FileAttribute<?>... attrs)
+ public static java.nio.channels.FileChannel open(Path file,
+ Set<? extends OpenOption> options,
+ FileAttribute<?>... attrs)
throws IOException
{
FileSystemProvider provider = file.getFileSystem().provider();
@@ -335,110 +335,13 @@ public abstract class FileChannel
*
* @since 1.7
*/
- public static FileChannel open(Path file, OpenOption... options)
+ public static java.nio.channels.FileChannel open(Path file, OpenOption... options)
throws IOException
{
Set<OpenOption> set = new HashSet<OpenOption>(options.length);
Collections.addAll(set, options);
return open(file, set, NO_ATTRIBUTES);
}
-
- // -- Channel operations --
-
- /**
- * Reads a sequence of bytes from this channel into the given buffer.
- *
- * <p> Bytes are read starting at this channel's current file position, and
- * then the file position is updated with the number of bytes actually
- * read. Otherwise this method behaves exactly as specified in the {@link
- * ReadableByteChannel} interface. </p>
- */
- public abstract int read(ByteBuffer dst) throws IOException;
-
- /**
- * Reads a sequence of bytes from this channel into a subsequence of the
- * given buffers.
- *
- * <p> Bytes are read starting at this channel's current file position, and
- * then the file position is updated with the number of bytes actually
- * read. Otherwise this method behaves exactly as specified in the {@link
- * ScatteringByteChannel} interface. </p>
- */
- public abstract long read(ByteBuffer[] dsts, int offset, int length)
- throws IOException;
-
- /**
- * Reads a sequence of bytes from this channel into the given buffers.
- *
- * <p> Bytes are read starting at this channel's current file position, and
- * then the file position is updated with the number of bytes actually
- * read. Otherwise this method behaves exactly as specified in the {@link
- * ScatteringByteChannel} interface. </p>
- */
- public final long read(ByteBuffer[] dsts) throws IOException {
- return read(dsts, 0, dsts.length);
- }
-
- /**
- * Writes a sequence of bytes to this channel from the given buffer.
- *
- * <p> Bytes are written starting at this channel's current file position
- * unless the channel is in append mode, in which case the position is
- * first advanced to the end of the file. The file is grown, if necessary,
- * to accommodate the written bytes, and then the file position is updated
- * with the number of bytes actually written. Otherwise this method
- * behaves exactly as specified by the {@link WritableByteChannel}
- * interface. </p>
- */
- public abstract int write(ByteBuffer src) throws IOException;
-
- /**
- * Writes a sequence of bytes to this channel from a subsequence of the
- * given buffers.
- *
- * <p> Bytes are written starting at this channel's current file position
- * unless the channel is in append mode, in which case the position is
- * first advanced to the end of the file. The file is grown, if necessary,
- * to accommodate the written bytes, and then the file position is updated
- * with the number of bytes actually written. Otherwise this method
- * behaves exactly as specified in the {@link GatheringByteChannel}
- * interface. </p>
- */
- public abstract long write(ByteBuffer[] srcs, int offset, int length)
- throws IOException;
-
- /**
- * Writes a sequence of bytes to this channel from the given buffers.
- *
- * <p> Bytes are written starting at this channel's current file position
- * unless the channel is in append mode, in which case the position is
- * first advanced to the end of the file. The file is grown, if necessary,
- * to accommodate the written bytes, and then the file position is updated
- * with the number of bytes actually written. Otherwise this method
- * behaves exactly as specified in the {@link GatheringByteChannel}
- * interface. </p>
- */
- public final long write(ByteBuffer[] srcs) throws IOException {
- return write(srcs, 0, srcs.length);
- }
-
-
- // -- Other operations --
-
- /**
- * Returns this channel's file position. </p>
- *
- * @return This channel's file position,
- * a non-negative integer counting the number of bytes
- * from the beginning of the file to the current position
- *
- * @throws ClosedChannelException
- * If this channel is closed
- *
- * @throws IOException
- * If some other I/O error occurs
- */
- public abstract long position() throws IOException;
/**
* Sets this channel's file position.
@@ -469,20 +372,6 @@ public abstract class FileChannel
public abstract FileChannel position(long newPosition) throws IOException;
/**
- * Returns the current size of this channel's file. </p>
- *
- * @return The current size of this channel's file,
- * measured in bytes
- *
- * @throws ClosedChannelException
- * If this channel is closed
- *
- * @throws IOException
- * If some other I/O error occurs
- */
- public abstract long size() throws IOException;
-
- /**
* Truncates this channel's file to the given size.
*
* <p> If the given size is less than the file's current size then the file
@@ -511,656 +400,5 @@ public abstract class FileChannel
*/
public abstract FileChannel truncate(long size) throws IOException;
- /**
- * Forces any updates to this channel's file to be written to the storage
- * device that contains it.
- *
- * <p> If this channel's file resides on a local storage device then when
- * this method returns it is guaranteed that all changes made to the file
- * since this channel was created, or since this method was last invoked,
- * will have been written to that device. This is useful for ensuring that
- * critical information is not lost in the event of a system crash.
- *
- * <p> If the file does not reside on a local device then no such guarantee
- * is made.
- *
- * <p> The <tt>metaData</tt> parameter can be used to limit the number of
- * I/O operations that this method is required to perform. Passing
- * <tt>false</tt> for this parameter indicates that only updates to the
- * file's content need be written to storage; passing <tt>true</tt>
- * indicates that updates to both the file's content and metadata must be
- * written, which generally requires at least one more I/O operation.
- * Whether this parameter actually has any effect is dependent upon the
- * underlying operating system and is therefore unspecified.
- *
- * <p> Invoking this method may cause an I/O operation to occur even if the
- * channel was only opened for reading. Some operating systems, for
- * example, maintain a last-access time as part of a file's metadata, and
- * this time is updated whenever the file is read. Whether or not this is
- * actually done is system-dependent and is therefore unspecified.
- *
- * <p> This method is only guaranteed to force changes that were made to
- * this channel's file via the methods defined in this class. It may or
- * may not force changes that were made by modifying the content of a
- * {@link MappedByteBuffer <i>mapped byte buffer</i>} obtained by
- * invoking the {@link #map map} method. Invoking the {@link
- * MappedByteBuffer#force force} method of the mapped byte buffer will
- * force changes made to the buffer's content to be written. </p>
- *
- * @param metaData
- * If <tt>true</tt> then this method is required to force changes
- * to both the file's content and metadata to be written to
- * storage; otherwise, it need only force content changes to be
- * written
- *
- * @throws ClosedChannelException
- * If this channel is closed
- *
- * @throws IOException
- * If some other I/O error occurs
- */
- public abstract void force(boolean metaData) throws IOException;
-
- /**
- * Transfers bytes from this channel's file to the given writable byte
- * channel.
- *
- * <p> An attempt is made to read up to <tt>count</tt> bytes starting at
- * the given <tt>position</tt> in this channel's file and write them to the
- * target channel. An invocation of this method may or may not transfer
- * all of the requested bytes; whether or not it does so depends upon the
- * natures and states of the channels. Fewer than the requested number of
- * bytes are transferred if this channel's file contains fewer than
- * <tt>count</tt> bytes starting at the given <tt>position</tt>, or if the
- * target channel is non-blocking and it has fewer than <tt>count</tt>
- * bytes free in its output buffer.
- *
- * <p> This method does not modify this channel's position. If the given
- * position is greater than the file's current size then no bytes are
- * transferred. If the target channel has a position then bytes are
- * written starting at that position and then the position is incremented
- * by the number of bytes written.
- *
- * <p> This method is potentially much more efficient than a simple loop
- * that reads from this channel and writes to the target channel. Many
- * operating systems can transfer bytes directly from the filesystem cache
- * to the target channel without actually copying them. </p>
- *
- * @param position
- * The position within the file at which the transfer is to begin;
- * must be non-negative
- *
- * @param count
- * The maximum number of bytes to be transferred; must be
- * non-negative
- *
- * @param target
- * The target channel
- *
- * @return The number of bytes, possibly zero,
- * that were actually transferred
- *
- * @throws IllegalArgumentException
- * If the preconditions on the parameters do not hold
- *
- * @throws NonReadableChannelException
- * If this channel was not opened for reading
- *
- * @throws NonWritableChannelException
- * If the target channel was not opened for writing
- *
- * @throws ClosedChannelException
- * If either this channel or the target channel is closed
- *
- * @throws AsynchronousCloseException
- * If another thread closes either channel
- * while the transfer is in progress
- *
- * @throws ClosedByInterruptException
- * If another thread interrupts the current thread while the
- * transfer is in progress, thereby closing both channels and
- * setting the current thread's interrupt status
- *
- * @throws IOException
- * If some other I/O error occurs
- */
- public abstract long transferTo(long position, long count,
- WritableByteChannel target)
- throws IOException;
-
- /**
- * Transfers bytes into this channel's file from the given readable byte
- * channel.
- *
- * <p> An attempt is made to read up to <tt>count</tt> bytes from the
- * source channel and write them to this channel's file starting at the
- * given <tt>position</tt>. An invocation of this method may or may not
- * transfer all of the requested bytes; whether or not it does so depends
- * upon the natures and states of the channels. Fewer than the requested
- * number of bytes will be transferred if the source channel has fewer than
- * <tt>count</tt> bytes remaining, or if the source channel is non-blocking
- * and has fewer than <tt>count</tt> bytes immediately available in its
- * input buffer.
- *
- * <p> This method does not modify this channel's position. If the given
- * position is greater than the file's current size then no bytes are
- * transferred. If the source channel has a position then bytes are read
- * starting at that position and then the position is incremented by the
- * number of bytes read.
- *
- * <p> This method is potentially much more efficient than a simple loop
- * that reads from the source channel and writes to this channel. Many
- * operating systems can transfer bytes directly from the source channel
- * into the filesystem cache without actually copying them. </p>
- *
- * @param src
- * The source channel
- *
- * @param position
- * The position within the file at which the transfer is to begin;
- * must be non-negative
- *
- * @param count
- * The maximum number of bytes to be transferred; must be
- * non-negative
- *
- * @return The number of bytes, possibly zero,
- * that were actually transferred
- *
- * @throws IllegalArgumentException
- * If the preconditions on the parameters do not hold
- *
- * @throws NonReadableChannelException
- * If the source channel was not opened for reading
- *
- * @throws NonWritableChannelException
- * If this channel was not opened for writing
- *
- * @throws ClosedChannelException
- * If either this channel or the source channel is closed
- *
- * @throws AsynchronousCloseException
- * If another thread closes either channel
- * while the transfer is in progress
- *
- * @throws ClosedByInterruptException
- * If another thread interrupts the current thread while the
- * transfer is in progress, thereby closing both channels and
- * setting the current thread's interrupt status
- *
- * @throws IOException
- * If some other I/O error occurs
- */
- public abstract long transferFrom(ReadableByteChannel src,
- long position, long count)
- throws IOException;
-
- /**
- * Reads a sequence of bytes from this channel into the given buffer,
- * starting at the given file position.
- *
- * <p> This method works in the same manner as the {@link
- * #read(ByteBuffer)} method, except that bytes are read starting at the
- * given file position rather than at the channel's current position. This
- * method does not modify this channel's position. If the given position
- * is greater than the file's current size then no bytes are read. </p>
- *
- * @param dst
- * The buffer into which bytes are to be transferred
- *
- * @param position
- * The file position at which the transfer is to begin;
- * must be non-negative
- *
- * @return The number of bytes read, possibly zero, or <tt>-1</tt> if the
- * given position is greater than or equal to the file's current
- * size
- *
- * @throws IllegalArgumentException
- * If the position is negative
- *
- * @throws NonReadableChannelException
- * If this channel was not opened for reading
- *
- * @throws ClosedChannelException
- * If this channel is closed
- *
- * @throws AsynchronousCloseException
- * If another thread closes this channel
- * while the read operation is in progress
- *
- * @throws ClosedByInterruptException
- * If another thread interrupts the current thread
- * while the read operation is in progress, thereby
- * closing the channel and setting the current thread's
- * interrupt status
- *
- * @throws IOException
- * If some other I/O error occurs
- */
- public abstract int read(ByteBuffer dst, long position) throws IOException;
-
- /**
- * Writes a sequence of bytes to this channel from the given buffer,
- * starting at the given file position.
- *
- * <p> This method works in the same manner as the {@link
- * #write(ByteBuffer)} method, except that bytes are written starting at
- * the given file position rather than at the channel's current position.
- * This method does not modify this channel's position. If the given
- * position is greater than the file's current size then the file will be
- * grown to accommodate the new bytes; the values of any bytes between the
- * previous end-of-file and the newly-written bytes are unspecified. </p>
- *
- * @param src
- * The buffer from which bytes are to be transferred
- *
- * @param position
- * The file position at which the transfer is to begin;
- * must be non-negative
- *
- * @return The number of bytes written, possibly zero
- *
- * @throws IllegalArgumentException
- * If the position is negative
- *
- * @throws NonWritableChannelException
- * If this channel was not opened for writing
- *
- * @throws ClosedChannelException
- * If this channel is closed
- *
- * @throws AsynchronousCloseException
- * If another thread closes this channel
- * while the write operation is in progress
- *
- * @throws ClosedByInterruptException
- * If another thread interrupts the current thread
- * while the write operation is in progress, thereby
- * closing the channel and setting the current thread's
- * interrupt status
- *
- * @throws IOException
- * If some other I/O error occurs
- */
- public abstract int write(ByteBuffer src, long position) throws IOException;
-
-
- // -- Memory-mapped buffers --
-
- /**
- * A typesafe enumeration for file-mapping modes.
- *
- * @since 1.4
- *
- * @see java.nio.channels.FileChannel#map
- */
- public static class MapMode {
-
- /**
- * Mode for a read-only mapping.
- */
- public static final MapMode READ_ONLY
- = new MapMode("READ_ONLY");
-
- /**
- * Mode for a read/write mapping.
- */
- public static final MapMode READ_WRITE
- = new MapMode("READ_WRITE");
-
- /**
- * Mode for a private (copy-on-write) mapping.
- */
- public static final MapMode PRIVATE
- = new MapMode("PRIVATE");
-
- private final String name;
-
- private MapMode(String name) {
- this.name = name;
- }
-
- /**
More information about the distro-pkg-dev
mailing list