Top Description Inners Fields Constructors Methods
org.jruby.util.io

public Class SelectExecutor

extends Object
Class Inheritance
Imports
jnr.enxio.channels.NativeSelectorProvider, org.jruby.Ruby, .RubyArray, .RubyIO, .RubyThread, org.jruby.api.Create, org.jruby.runtime.ThreadContext, org.jruby.runtime.builtin.IRubyObject, org.jruby.util.TypeConverter, java.io.IOException, java.nio.ByteBuffer, java.nio.channels.Pipe, .SelectableChannel, .SelectionKey, .Selector, java.nio.channels.spi.SelectorProvider, java.util.ArrayList, .Collections, .List, java.util.concurrent.Callable, .ExecutionException, .Future

Created by headius on 6/3/14.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
pack-priv List<SelectExecutor.ENXIOSelector>
pack-priv List<SelectionKey>
pack-priv final IRubyObject
pack-priv Selector
pack-priv List<ChannelFD>
pack-priv final IRubyObject
public static final int
pack-priv List<SelectionKey>
pack-priv final Ruby
pack-priv List<Selector>
private static final RubyThread.Task<SelectExecutor, Integer>
pack-priv Long
pack-priv List<ChannelFD>
pack-priv List<ChannelFD>
pack-priv final IRubyObject
public static final int
pack-priv List<SelectionKey>

Constructor Summary

AccessConstructor and Description
public
SelectExecutor(IRubyObject read, IRubyObject write, IRubyObject except, Long timeout)

Method Summary

Modifier and TypeMethod and Description
private int
private boolean
fdIsSet(List<SelectionKey> fds, ChannelFD fd, final int operations)

private void
fdSetRead(ThreadContext context, ChannelFD fd, int maxSize)

private void
fdSetWrite(ThreadContext context, ChannelFD fd, int maxSize)

private Selector
public IRubyObject
go(ThreadContext context)

private int
private int
private static SelectionKey
registerSelect(Selector selector, ChannelFD attachment, SelectableChannel channel, int ops)

pack-priv IRubyObject
pack-priv IRubyObject
pack-priv IRubyObject
private int
private SelectionKey
private SelectionKey
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

enxioSelectorsback to summary
pack-priv List<SelectExecutor.ENXIOSelector> enxioSelectors
errorKeyListback to summary
pack-priv List<SelectionKey> errorKeyList
exceptback to summary
pack-priv final IRubyObject except
mainSelectorback to summary
pack-priv Selector mainSelector
pendingReadFDsback to summary
pack-priv List<ChannelFD> pendingReadFDs
readback to summary
pack-priv final IRubyObject read
READ_ACCEPT_OPSback to summary
public static final int READ_ACCEPT_OPS
readKeyListback to summary
pack-priv List<SelectionKey> readKeyList
runtimeback to summary
pack-priv final Ruby runtime
selectorsback to summary
pack-priv List<Selector> selectors
SelectTaskback to summary
private static final RubyThread.Task<SelectExecutor, Integer> SelectTask
timeoutback to summary
pack-priv Long timeout
unselectableReadFDsback to summary
pack-priv List<ChannelFD> unselectableReadFDs
unselectableWriteFDsback to summary
pack-priv List<ChannelFD> unselectableWriteFDs
writeback to summary
pack-priv final IRubyObject write
WRITE_CONNECT_OPSback to summary
public static final int WRITE_CONNECT_OPS
writeKeyListback to summary
pack-priv List<SelectionKey> writeKeyList

Constructor Detail

SelectExecutorback to summary
public SelectExecutor(IRubyObject read, IRubyObject write, IRubyObject except, Long timeout)

Method Detail

doSelectback to summary
private int doSelect(ThreadContext context)
fdIsSetback to summary
private boolean fdIsSet(List<SelectionKey> fds, ChannelFD fd, final int operations)
fdSetReadback to summary
private void fdSetRead(ThreadContext context, ChannelFD fd, int maxSize) throws IOException
fdSetWriteback to summary
private void fdSetWrite(ThreadContext context, ChannelFD fd, int maxSize) throws IOException
getSelectorback to summary
private Selector getSelector(ThreadContext context, SelectableChannel channel) throws IOException
goback to summary
public IRubyObject go(ThreadContext context)
maxReadReadySizeback to summary
private int maxReadReadySize()
maxWriteReadySizeback to summary
private int maxWriteReadySize()
registerSelectback to summary
private static SelectionKey registerSelect(Selector selector, ChannelFD attachment, SelectableChannel channel, int ops) throws IOException
selectCallback to summary
pack-priv IRubyObject selectCall(ThreadContext context) throws IOException
selectEndback to summary
pack-priv IRubyObject selectEnd(ThreadContext context) throws IOException
selectInternalback to summary
pack-priv IRubyObject selectInternal(ThreadContext context) throws IOException
threadFdSelectback to summary
private int threadFdSelect(ThreadContext context)
trySelectReadback to summary
private SelectionKey trySelectRead(ThreadContext context, ChannelFD fd) throws IOException
trySelectWriteback to summary
private SelectionKey trySelectWrite(ThreadContext context, ChannelFD fd) throws IOException
org.jruby.util.io back to summary

private final Class SelectExecutor.ENXIOSelector

extends Object
implements Callable<Object>
Class Inheritance
All Implemented Interfaces
java.util.concurrent.Callable

Field Summary

Modifier and TypeField and Description
private final Pipe
private final Selector

Constructor Summary

AccessConstructor and Description
private
ENXIOSelector(Selector selector, Pipe pipe)

Method Summary

Modifier and TypeMethod and Description
public Object
call()

Implements java.util.concurrent.Callable.call.

Computes a result, or throws an exception if unable to do so.

public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

pipeback to summary
private final Pipe pipe
selectorback to summary
private final Selector selector

Constructor Detail

ENXIOSelectorback to summary
private ENXIOSelector(Selector selector, Pipe pipe)

Method Detail

callback to summary
public Object call() throws Exception

Implements java.util.concurrent.Callable.call.

Doc from java.util.concurrent.Callable.call.

Computes a result, or throws an exception if unable to do so.

Returns:Object

computed result

Exceptions
Exception:
if unable to compute a result
cleanupback to summary
public void cleanup() throws IOException