java.lang.Objectjava.nio.channels.Selector
java.nio.channels.spi.AbstractSelector
public abstract class AbstractSelector
Base implementation class for selectors.
This class encapsulates the low-level machinery required to implement
the interruption of selection operations. A concrete selector class must
invoke the This class also defines methods for maintaining a selector's
cancelled-key set and for removing a key from its channel's key set, and
declares the abstract
begin and end methods before and
after, respectively, invoking an I/O operation that might block
indefinitely. In order to ensure that the end method is always
invoked, these methods should be used within a
try ... finally block:
register method that is invoked by a
selectable channel's register
method in order to perform the actual work of registering a channel.
| Constructor Summary | |
|---|---|
protected |
AbstractSelector(SelectorProvider provider)
Initializes a new instance of this class. |
| Method Summary | |
|---|---|
protected void |
begin()
Marks the beginning of an I/O operation that might block indefinitely. |
protected Set<SelectionKey> |
cancelledKeys()
Retrieves this selector's cancelled-key set. |
void |
close()
Closes this selector. |
protected void |
deregister(AbstractSelectionKey key)
Removes the given key from its channel's key set. |
protected void |
end()
Marks the end of an I/O operation that might block indefinitely. |
protected abstract void |
implCloseSelector()
Closes this selector. |
boolean |
isOpen()
Tells whether or not this selector is open. |
SelectorProvider |
provider()
Returns the provider that created this channel. |
protected abstract SelectionKey |
register(AbstractSelectableChannel ch,
int ops,
Object att)
Registers the given channel with this selector. |
| Methods inherited from class java.nio.channels.Selector |
|---|
keys, open, select, select, selectedKeys, selectNow, wakeup |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected AbstractSelector(SelectorProvider provider)
| Method Detail |
|---|
public final void close()
throws IOException
If the selector has already been closed then this method returns
immediately. Otherwise it marks the selector as closed and then invokes
the implCloseSelector method in order to
complete the close operation.
IOException - If an I/O error occurs
protected abstract void implCloseSelector()
throws IOException
This method is invoked by the close method in order
to perform the actual work of closing the selector. This method is only
invoked if the selector has not yet been closed, and it is never invoked
more than once.
An implementation of this method must arrange for any other thread
that is blocked in a selection operation upon this selector to return
immediately as if by invoking the wakeup method.
IOException - If an I/O error occurs while closing the selectorpublic final boolean isOpen()
Selector
public final SelectorProvider provider()
protected final Set<SelectionKey> cancelledKeys()
This set should only be used while synchronized upon it.
protected abstract SelectionKey register(AbstractSelectableChannel ch, int ops, Object att)
This method is invoked by a channel's register method in order to perform
the actual work of registering the channel with this selector.
ch - The channel to be registeredops - The initial interest set, which must be validatt - The initial attachment for the resulting key
protected final void deregister(AbstractSelectionKey key)
This method must be invoked by the selector for each channel that it deregisters.
key - The selection key to be removedprotected final void begin()
This method should be invoked in tandem with the end
method, using a try ... finally block as
shown above, in order to implement interruption for
this selector.
Invoking this method arranges for the selector's wakeup method to be invoked if a thread's interrupt method is invoked while the thread is
blocked in an I/O operation upon the selector.
protected final void end()
This method should be invoked in tandem with the end
method, using a try ... finally block as
shown above, in order to implement interruption for
this selector.
Ces informations proviennent du site de http://java.sun.com
Le contenu de cette page provient du site de Sun, et est généré depuis un cache sur l'infobrol après certains traitements automatisés. La présentation peut donc différer du document original, mais le contenu aussi. Vous pouvez utiliser ce bouton pour afficher la page originale du site de Sun :
Maintenir les pages en cache sur différents sites peut offrir plus de disponibilité.
Chaque page est indexée dans la base de donnée, ce qui permet de retrouver facilement les informations, au moyen des sommaires, du moteur de recherche interne, etc.
Des facilités sont mises en place pour que les membres de l'infobrol puissent effectuer des traductions en français des différents documents. Ceci devrait permettre aux débutants en programmation Java de consulter les API en français s'ils maîtrisent moins bien la langue de Shakespeare. Dans le cas où une traduction a été soumise, elle est disponible au moyen d'un lien en bas de page. Si la traduction a été validée, la page s'affiche par défaut en français, et un lien en bas de page permet d'atteindre la version en anglais.
Le code sur l'infobrol est automatiquement coloré selon la syntaxe, et les différents mots clés sont transformés en liens pour accéder rapidement aux informations.
Vous avez la possibilité de partager vos expériences en proposant vos propres extraits de code en utilisant le bouton "ajouter un commentaire" en bas de page. Si vous visitez simplement l'infobrol, vous avez déjà accès à cette fonction, mais si vous étes membre du brol, vous pouvez en plus utiliser des boutons supplémentaires de mise en forme, dont la coloration automatique de vos extraits de codes.
Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher les interactions avec les réseaux sociaux sur ces pages.
8 mots clés dont 0 définis manuellement (plus d'information...).
Avertissement
Cette page ne possède pas encore de mots clés manuels, ceci est donc un exemple automatique (les niveaux de pertinence sont fictifs, mais les liens sont valables). Pour tester le nuage avec une page qui contient des mots définis manuellement, vous pouvez cliquer ici.Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher le nuage de mots clés.
Recherche (afficher)
Utilisateur (masquer)
Navigation (masquer)
Apparence (afficher)
Stats (afficher)
Citation (masquer)