Class VirtualChannelSelectorImpl
java.lang.Object
com.biglybt.core.networkmanager.impl.tcp.VirtualChannelSelectorImpl
Provides a simplified and safe (selectable-channel) socket single-op selector.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
private static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
private long
private boolean
(package private) static final AESemaphore
private final int
private long
private long
private long
private boolean
private static final LogIDs
private static final boolean
private int
protected final VirtualChannelSelector
private final boolean
private final HashMap<AbstractSelectableChannel,
Boolean> private boolean
private final Map<AbstractSelectableChannel,
Object> private final AEMonitor
private boolean
private int
protected Selector
private final SelectorGuard
private static final int
private static final int
private static final int
-
Constructor Summary
ConstructorsConstructorDescriptionVirtualChannelSelectorImpl
(VirtualChannelSelector _parent, int _interest_op, boolean _pause_after_select, boolean _randomise_keys) -
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel
(AbstractSelectableChannel channel) protected void
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 occurprivate static Selector
boolean
isPaused
(AbstractSelectableChannel channel) boolean
isRegistered
(AbstractSelectableChannel channel) protected Selector
void
pauseSelects
(AbstractSelectableChannel channel) void
register
(AbstractSelectableChannel channel, VirtualChannelSelector.VirtualAbstractSelectorListener listener, Object attachment) void
resumeSelects
(AbstractSelectableChannel channel) int
select
(long timeout) void
setRandomiseKeys
(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
-
VirtualChannelSelectorImpl
public VirtualChannelSelectorImpl(VirtualChannelSelector _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()
-