Liking cljdoc? Tell your friends :D

easy-nio.selector

Wrapper around java.nio.channels.Selector.

Wrapper around java.nio.channels.Selector.
raw docstring

acceptable?clj

(acceptable? key)

Returns true if key's channel is ready to accept a new socket connection.

Returns true if `key`'s channel is ready to accept 
a new socket connection.
sourceraw docstring

all-keysclj

(all-keys sel)

Returns the set of all keys registered with sel, including those not yet ready.

Returns the set of all keys registered with `sel`, including those
not yet ready.
sourceraw docstring

attachmentclj

(attachment key)

Returns the attachment associated with key, or nil if none.

Returns the attachment associated with `key`, or nil if none.
sourceraw docstring

channelclj

(channel key)

Returns the channel associated with key.

Returns the channel associated with `key`.
sourceraw docstring

clear-keys!clj

(clear-keys! selected)

Removes all keys from the selected-key set after processing. Call this after all keys in selected have been handled.

Removes all keys from the selected-key set after processing.
Call this after all keys in `selected` have been handled.
sourceraw docstring

close!clj

(close! sel)

Closes sel.

Closes `sel`.
sourceraw docstring

connectable?clj

(connectable? key)

Returns true if key's channel is ready to complete a connection.

Returns true if `key`'s channel is ready to complete a connection.
sourceraw docstring

deregister!clj

(deregister! key)

Cancels key, removing its channel from the selector. The key becomes invalid immediately. The cancellation takes effect on the next select! call.

Cancels `key`, removing its channel from the selector.
The key becomes invalid immediately. The cancellation 
takes effect on the next select! call.
sourceraw docstring

get-interestsclj

(get-interests key)

Retrieves this key's interest set. It is guaranteed that the returned set will only contain operation bits that are valid for this key's channel.

Retrieves this key's interest set. It is guaranteed that 
the returned set will only contain operation bits 
that are valid for this key's channel. 
sourceraw docstring

op-acceptclj

source

op-connectclj

source

op-readclj

source

op-writeclj

source

open?clj

(open? sel)

Returns true if sel is open.

Returns true if `sel` is open.
sourceraw docstring

readable?clj

(readable? key)

Returns true if key's channel is ready for reading.

Returns true if `key`'s channel is ready for reading.
sourceraw docstring

register!clj

(register! ch sel ops)
(register! ch sel ops attachment)

Registers channel ch with selector sel for the given operations ops (a bitwise OR of op-read, op-write, op-accept, op-connect). Optionally accepts an attachment — any object — stored on the key and retrievable via (attachment key). Useful for associating per-channel state (e.g. a buffer, a handler, a connection id). Returns the resulting SelectionKey.

Registers channel `ch` with selector `sel` for 
the given operations `ops` (a bitwise OR of
op-read, op-write, op-accept, op-connect).
Optionally accepts an `attachment` — any object — stored on the key
and retrievable via (attachment key). Useful for associating
per-channel state (e.g. a buffer, a handler, a connection id).
Returns the resulting SelectionKey.
sourceraw docstring

select!clj

(select! sel)

Selects a set of keys whose corresponding channels are ready for I/O operations. Blocks until at least one channel is ready for an operation it is registered for.

Selects a set of keys whose corresponding channels are 
ready for I/O operations. Blocks until at least 
one channel is ready for an operation it is registered for.
sourceraw docstring

select-now!clj

(select-now! sel)

Non-blocking select. Returns immediately with the number of keys whose ready-op sets were updated since the last select call. Returns 0 if no channels are ready.

Non-blocking select. Returns immediately with the number of keys
whose ready-op sets were updated since the last select call.
Returns 0 if no channels are ready.
sourceraw docstring

select-timeout!clj

(select-timeout! sel timeout-ms)

Like select!, but blocks for at most timeout-ms milliseconds. Returns the number of keys whose ready-operation sets were updated.

Like select!, but blocks for at most `timeout-ms` milliseconds.
Returns the number of keys  whose ready-operation sets were updated.
sourceraw docstring

selected-keysclj

(selected-keys sel)

Returns the mutable Set of SelectionKeys that are ready.

Returns the mutable Set of SelectionKeys that are ready.
sourceraw docstring

selectorclj

(selector)

Opens and returns a new Selector.

Opens and returns a new Selector.
sourceraw docstring

set-interests!clj

(set-interests! key ops)

Updates the interest ops of key to ops. Useful for switching a channel between read and write interest mid-lifecycle, e.g. after accumulating a full response to send. Returns key.

Updates the interest ops of `key` to `ops`.
Useful for switching a channel between read and write interest
mid-lifecycle, e.g. after accumulating a full response to send.
Returns `key`.
sourceraw docstring

valid?clj

(valid? key)

Returns true if key is still registered with its selector.

Returns true if `key` is still registered with its selector.
sourceraw docstring

wakeup!clj

(wakeup! sel)

Causes the first selection operation that has not yet returned to return immediately. Returns sel.

Causes the first selection operation that has 
not yet returned to return immediately. 
Returns `sel`.
sourceraw docstring

writable?clj

(writable? key)

Returns true if key's channel is ready for writing.

Returns true if `key`'s channel is ready for writing.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close