Class VirtualAbstractChannelSelectorImpl
java.lang.Object
com.biglybt.core.networkmanager.impl.VirtualAbstractChannelSelectorImpl
Provides a simplified and safe (selectable-channel) socket single-op selector.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classprivate static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate longprivate boolean(package private) static final AESemaphoreprivate final intprivate longprivate longprivate longprivate booleanprivate static final LogIDsprivate static final booleanprivate intprotected final VirtualAbstractChannelSelectorprivate final booleanprivate final HashMap<AbstractSelectableChannel, Boolean> private booleanprivate final Map<AbstractSelectableChannel, Object> private final AEMonitorprivate booleanprivate intprotected Selectorprivate final SelectorGuardprivate static final intprivate static final intprivate static final int -
Constructor Summary
ConstructorsConstructorDescriptionVirtualAbstractChannelSelectorImpl(VirtualAbstractChannelSelector _parent, int _interest_op, boolean _pause_after_select, boolean _randomise_keys) -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel(AbstractSelectableChannel channel) protected voidvoiddestroy()Note that you have to ensure that a select operation is performed on the normal select loop *after* destroying the selector to actually cause the destroy to occurprivate static SelectorbooleanisPaused(AbstractSelectableChannel channel) booleanisRegistered(AbstractSelectableChannel channel) protected SelectorvoidpauseSelects(AbstractSelectableChannel channel) voidregister(AbstractSelectableChannel channel, VirtualChannelSelector.VirtualAbstractSelectorListener listener, Object attachment) voidresumeSelects(AbstractSelectableChannel channel) intselect(long timeout) voidsetRandomiseKeys(boolean r)
-
Field Details
-
LOGID
-
MAYBE_BROKEN_SELECT
private static final boolean MAYBE_BROKEN_SELECT -
SELECTOR_TIMEOUT
private static final int SELECTOR_TIMEOUT- See Also:
-
get_selector_allowed
-
select_is_broken
private boolean select_is_broken -
select_looks_broken_count
private int select_looks_broken_count -
logged_broken_select
private boolean logged_broken_select -
selector
-
selector_guard
-
consec_select_fails
private int consec_select_fails -
consec_select_fails_start
private long consec_select_fails_start -
register_cancel_list
-
register_cancel_list_mon
-
paused_states
-
INTEREST_OP
private final int INTEREST_OP -
pause_after_select
private final boolean pause_after_select -
parent
-
destroyed
private volatile boolean destroyed -
randomise_keys
private boolean randomise_keys -
next_select_loop_pos
private int next_select_loop_pos -
WRITE_SELECTOR_DEBUG_CHECK_PERIOD
private static final int WRITE_SELECTOR_DEBUG_CHECK_PERIOD- See Also:
-
WRITE_SELECTOR_DEBUG_MAX_TIME
private static final int WRITE_SELECTOR_DEBUG_MAX_TIME- See Also:
-
last_write_select_debug
private long last_write_select_debug -
last_select_debug
private long last_select_debug -
last_reopen_attempt
private long last_reopen_attempt
-
-
Constructor Details
-
VirtualAbstractChannelSelectorImpl
public VirtualAbstractChannelSelectorImpl(VirtualAbstractChannelSelector _parent, int _interest_op, boolean _pause_after_select, boolean _randomise_keys)
-
-
Method Details
-
getSelector
- Throws:
IOException
-
openNewSelector
-
setRandomiseKeys
public void setRandomiseKeys(boolean r) -
isPaused
-
pauseSelects
-
resumeSelects
-
isRegistered
-
cancel
-
register
public void register(AbstractSelectableChannel channel, VirtualChannelSelector.VirtualAbstractSelectorListener listener, Object attachment) -
select
public int select(long timeout) -
destroy
public void destroy()Note that you have to ensure that a select operation is performed on the normal select loop *after* destroying the selector to actually cause the destroy to occur -
closeExistingSelector
protected void closeExistingSelector()
-