Package com.sun.corba.ee.impl.transport
Class TemporarySelector
java.lang.Object
com.sun.corba.ee.impl.transport.TemporarySelector
Encapsulates a temporary Selector and temporary Selector state
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTemporarySelector
(SelectableChannel theSelectableChannel) Creates a new instance of TemporarySelector -
Method Summary
Modifier and TypeMethodDescriptionvoid
cancelAndFlushSelector
(SelectionKey theSelectionKey) void
close()
NOTE: There is a potential for a situation, (albiet very remote), that some other thread may be in this TemporarySelector's select() method while another thread is trying to call this "close" method as a result of an explicit close of a Connection (if someone overrides the implementation of SocketOrChannelConnectionImpl and makes an explicit call to "close" the Connection), that call to close the Connection may also attempt to call this close method.registerChannel
(SelectableChannel theSelectableChannel, int theOps) void
removeSelectedKey
(SelectionKey theSelectionKey) int
select
(long theTimeout) NOTE: There is a potential for a situation, (albeit very remote), that some other thread may be initiating an explicit "close" of a Connection (if someone overrides the implementation of SocketOrChannelConnectionImpl and an explicit call to "close" the Connection), that call to close the Connection may also attempt to close a TemporarySelector.
-
Field Details
-
itsState
-
itsSelector
-
-
Constructor Details
-
TemporarySelector
Creates a new instance of TemporarySelector- Parameters:
theSelectableChannel
- channel to select- Throws:
IOException
- If an I/O error occurs
-
-
Method Details
-
select
NOTE: There is a potential for a situation, (albeit very remote), that some other thread may be initiating an explicit "close" of a Connection (if someone overrides the implementation of SocketOrChannelConnectionImpl and an explicit call to "close" the Connection), that call to close the Connection may also attempt to close a TemporarySelector. If that TemporarySelector is currently in the select(long theTimeout), then the closing of that TemporarySelector will not occur until the select(long theTimeout) method exits, (i.e. maximum blocking wait time for the close will be theTimeout milliseconds which by default is 2000 milliseconds).This artifact occurs as a result of the TemporarySelector's select() and close() operations being atomic operations. However, this potential issue does not exist in the current implementation of SocketOrChannelConnectionImpl. It may arise if someone chooses to extend the implementation of the SocketOrChannelConnectionImpl and make explicit calls to close the Connection. An example of this potential scenario can be found in the "no connection cache" plug-in implementation. To avoid this potential scenario, the "no connection cache" plug-in disables the read optimization to always enter a blocking read.
- Parameters:
theTimeout
- If positive, block for up to theTimeout milliseconds, more or less, while waiting for a SelectableChannel to become ready; must be greater than 0 in value- Returns:
- The number of keys, possibly zero, whose ready-operation sets was updated.
- Throws:
IOException
- If an I/O error occurs- See Also:
-
registerChannel
public SelectionKey registerChannel(SelectableChannel theSelectableChannel, int theOps) throws IOException - Throws:
IOException
-
close
NOTE: There is a potential for a situation, (albiet very remote), that some other thread may be in this TemporarySelector's select() method while another thread is trying to call this "close" method as a result of an explicit close of a Connection (if someone overrides the implementation of SocketOrChannelConnectionImpl and makes an explicit call to "close" the Connection), that call to close the Connection may also attempt to call this close method. If that other thread is currently in this TemporarySelector's select(long theTimeout) method, then the call to this close method will block until the select(long theTimeout) method exits, (i.e. maximum blocking wait time for this close will be theTimeout milliseconds which by default is 2000 milliseconds). This artifact occurs as a result of the TemporarySelector's select() and close() operations being atomic operations. However, this potential issue does not exist in the current implementation of SocketOrChannelConnectionImpl. It may arise if someone chooses to extend the implementation of the SocketOrChannelConnectionImpl and make explicit calls to close the Connection. An example of this potential scenario exists in the "no connection cache" plug-in. To avoid this scenario, the "no connection cache" plug-in disables the read optimization to always enter a blocking read. See com.sun.corba.ee.impl.plugin.hwlb.NoConnectionCacheImpl.java to see how the 'always enter blocking read' optimization is disabled.- Throws:
IOException
- If an I/O error occurs
-
removeSelectedKey
- Throws:
IOException
-
cancelAndFlushSelector
- Throws:
IOException
-