IT. Expert System.

Android Reference

AbstractInterruptibleChannel


java.nio.channels.spi

Class AbstractInterruptibleChannel

  • All Implemented Interfaces:
    Closeable, AutoCloseable, Channel, InterruptibleChannel
    Direct Known Subclasses:
    FileChannel, SelectableChannel


    public abstract class AbstractInterruptibleChannel
    extends Object
    implements Channel, InterruptibleChannel
    AbstractInterruptibleChannel is the root class for interruptible channels.

    The basic usage pattern for an interruptible channel is to invoke begin() before any I/O operation that potentially blocks indefinitely, then end(boolean) after completing the operation. The argument to the end method should indicate if the I/O operation has actually completed so that any change may be visible to the invoker.

    • Method Summary

      Methods
      Modifier and Type Method and Description
      protected void begin()
      Indicates the beginning of a code section that includes an I/O operation that is potentially blocking.
      void close()
      Closes an open channel.
      protected void end(boolean success)
      Indicates the end of a code section that has been started with begin() and that includes a potentially blocking I/O operation.
      protected abstract void implCloseChannel()
      Implements the channel closing behavior.
      boolean isOpen()
      Returns true if this channel is open.
    • Constructor Detail

      • AbstractInterruptibleChannel

        protected AbstractInterruptibleChannel()
    • Method Detail

      • isOpen

        public final boolean isOpen()
        Description copied from interface: Channel
        Returns true if this channel is open.
        Specified by:
        isOpen in interface Channel
      • close

        public final void close()
                         throws IOException
        Closes an open channel. If the channel is already closed then this method has no effect, otherwise it closes the receiver via the implCloseChannel method.

        If an attempt is made to perform an operation on a closed channel then a ClosedChannelException is thrown.

        If multiple threads attempt to simultaneously close a channel, then only one thread will run the closure code and the others will be blocked until the first one completes.

        Specified by:
        close in interface Closeable
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface Channel
        Specified by:
        close in interface InterruptibleChannel
        Throws:
        IOException - if a problem occurs while closing this channel.
        See Also:
        Channel.close()
      • begin

        protected final void begin()
        Indicates the beginning of a code section that includes an I/O operation that is potentially blocking. After this operation, the application should invoke the corresponding end(boolean) method.
      • end

        protected final void end(boolean success)
                          throws AsynchronousCloseException
        Indicates the end of a code section that has been started with begin() and that includes a potentially blocking I/O operation.
        Parameters:
        success - pass true if the blocking operation has succeeded and has had a noticeable effect; false otherwise.
        Throws:
        AsynchronousCloseException - if this channel is closed by another thread while this method is executing.
        ClosedByInterruptException - if another thread interrupts the calling thread while this method is executing.
      • implCloseChannel

        protected abstract void implCloseChannel()
                                          throws IOException
        Implements the channel closing behavior.

        Closes the channel with a guarantee that the channel is not currently closed through another invocation of close() and that the method is thread-safe.

        Any outstanding threads blocked on I/O operations on this channel must be released with either a normal return code, or by throwing an AsynchronousCloseException.

        Throws:
        IOException - if a problem occurs while closing the channel.


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 34 / . Delta: 0.01888 с