com.sleepycat.je.rep.utilint
Class NamedChannelWithTimeout
java.lang.Object
com.sleepycat.je.rep.utilint.NamedChannel
com.sleepycat.je.rep.utilint.NamedChannelWithTimeout
- All Implemented Interfaces:
- Closeable, ByteChannel, Channel, ReadableByteChannel, WritableByteChannel
public class NamedChannelWithTimeout
- extends NamedChannel
NamedChannelWithTimeout permits association of timeouts with a SocketChannel.
This mechanism is necessary, since the standard mechanism for associating
timeouts with sockets using Socket.setSoTimeout is not supported by nio
SocketChannels.
|
Method Summary |
void |
close()
|
boolean |
isActive(long timeMs)
Method invoked by the time thread to check on the channel on a periodic
basis. |
int |
read(ByteBuffer dst)
|
void |
setTimeoutMs(int timeoutMs)
Used to modify the timeout associated with the channel. |
NamedChannelWithTimeout
public NamedChannelWithTimeout(RepNode repNode,
SocketChannel channel,
int timeoutMs)
setTimeoutMs
public void setTimeoutMs(int timeoutMs)
- Used to modify the timeout associated with the channel.
- Parameters:
timeoutMs - the new timeout value
read
public int read(ByteBuffer dst)
throws IOException
- Specified by:
read in interface ReadableByteChannel- Overrides:
read in class NamedChannel
- Throws:
IOException
close
public void close()
throws IOException
- Specified by:
close in interface Closeable- Specified by:
close in interface Channel- Overrides:
close in class NamedChannel
- Throws:
IOException
isActive
public boolean isActive(long timeMs)
- Method invoked by the time thread to check on the channel on a periodic
basis. Note that the time that is passed in is a "pseudo" time that is
only meaningful for calculating time differences.
- Parameters:
timeMs - the pseudo time
- Returns:
- true if the channel is active, false if it isn't and has been
closed
Copyright (c) 2004-2010 Oracle. All rights reserved.