com.sleepycat.je.rep.utilint
Class NamedChannel

java.lang.Object
  extended by com.sleepycat.je.rep.utilint.NamedChannel
All Implemented Interfaces:
Closeable, ByteChannel, Channel, ReadableByteChannel, WritableByteChannel
Direct Known Subclasses:
NamedChannelWithTimeout

public class NamedChannel
extends Object
implements ByteChannel

Packages a SocketChannel and a NameIdPair together so that logging messages can show the node name instead of the channel toString();


Field Summary
protected  SocketChannel channel
           
 
Constructor Summary
NamedChannel(SocketChannel channel)
           
NamedChannel(SocketChannel channel, NameIdPair nameIdPair)
           
 
Method Summary
 void close()
           
 SocketChannel getChannel()
           
 NameIdPair getNameIdPair()
           
 boolean isOpen()
           
 int read(ByteBuffer dst)
           
 void setNameIdPair(NameIdPair nameIdPair)
           
 String toString()
           
 int write(ByteBuffer src)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

channel

protected final SocketChannel channel
Constructor Detail

NamedChannel

public NamedChannel(SocketChannel channel,
                    NameIdPair nameIdPair)

NamedChannel

public NamedChannel(SocketChannel channel)
Method Detail

setNameIdPair

public void setNameIdPair(NameIdPair nameIdPair)

getNameIdPair

public NameIdPair getNameIdPair()

getChannel

public SocketChannel getChannel()

toString

public String toString()
Overrides:
toString in class Object

read

public int read(ByteBuffer dst)
         throws IOException
Specified by:
read in interface ReadableByteChannel
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Specified by:
close in interface Channel
Throws:
IOException

isOpen

public boolean isOpen()
Specified by:
isOpen in interface Channel

write

public int write(ByteBuffer src)
          throws IOException
Specified by:
write in interface WritableByteChannel
Throws:
IOException


Copyright (c) 2004-2010 Oracle. All rights reserved.