Geen cache-versie.

Caching uitgeschakeld. Standaardinstelling voor deze pagina:ingeschakeld (code LNG204)
Als het scherm te langzaam is, kunt u de gebruikersmodus uitschakelen om de cacheversie te bekijken.
java.nio.channels

Interface AsynchronousChannel

  • All Superinterfaces:
    AutoCloseable, Channel, Closeable
    All Known Subinterfaces:
    AsynchronousByteChannel
    All Known Implementing Classes:
    AsynchronousFileChannel, AsynchronousServerSocketChannel, AsynchronousSocketChannel

    public interface AsynchronousChannel
    extends Channel
    A channel that supports asynchronous I/O operations. Asynchronous I/O operations will usually take one of two forms:
    1. Future<V> operation(...)
    2. void operation(... A attachment, CompletionHandler<V,? super A> handler)
    where operation is the name of the I/O operation (read or write for example), V is the result type of the I/O operation, and A is the type of an object attached to the I/O operation to provide context when consuming the result. The attachment is important for cases where a state-less CompletionHandler is used to consume the result of many I/O operations.

    In the first form, the methods defined by the Future interface may be used to check if the operation has completed, wait for its completion, and to retrieve the result. In the second form, a CompletionHandler is invoked to consume the result of the I/O operation when it completes or fails.

    A channel that implements this interface is asynchronously closeable: If an I/O operation is outstanding on the channel and the channel's close method is invoked, then the I/O operation fails with the exception AsynchronousCloseException.

    Asynchronous channels are safe for use by multiple concurrent threads. Some channel implementations may support concurrent reading and writing, but may not allow more than one read and one write operation to be outstanding at any given time.

    Cancellation

    The Future interface defines the cancel method to cancel execution. This causes all threads waiting on the result of the I/O operation to throw CancellationException. Whether the underlying I/O operation can be cancelled is highly implementation specific and therefore not specified. Where cancellation leaves the channel, or the entity to which it is connected, in an inconsistent state, then the channel is put into an implementation specific error state that prevents further attempts to initiate I/O operations that are similar to the operation that was cancelled. For example, if a read operation is cancelled but the implementation cannot guarantee that bytes have not been read from the channel then it puts the channel into an error state; further attempts to initiate a read operation cause an unspecified runtime exception to be thrown. Similarly, if a write operation is cancelled but the implementation cannot guarantee that bytes have not been written to the channel then subsequent attempts to initiate a write will fail with an unspecified runtime exception.

    Where the cancel method is invoked with the mayInterruptIfRunning parameter set to true then the I/O operation may be interrupted by closing the channel. In that case all threads waiting on the result of the I/O operation throw CancellationException and any other I/O operations outstanding on the channel complete with the exception AsynchronousCloseException.

    Where the cancel method is invoked to cancel read or write operations then it is recommended that all buffers used in the I/O operations be discarded or care taken to ensure that the buffers are not accessed while the channel remains open.

    Since:
    1.7

Nederlandse vertaling

U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.

Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.

Bij voorbaat dank.

Document heeft de 11/06/2005 gemaakt, de laatste keer de 04/03/2020 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-rf-java/nio/channels/AsynchronousChannel.html

De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.

Referenties

  1. Bekijk - html-document Taal van het document:fr Manuel PHP : https://docs.oracle.com

Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.

Inhoudsopgave Haut