com.hazelcast.nio.tcp
Class DefaultSocketChannelWrapper

java.lang.Object
  extended by com.hazelcast.nio.tcp.DefaultSocketChannelWrapper
All Implemented Interfaces:
SocketChannelWrapper, Closeable

public class DefaultSocketChannelWrapper
extends Object
implements SocketChannelWrapper


Field Summary
protected  SocketChannel socketChannel
           
 
Constructor Summary
DefaultSocketChannelWrapper(SocketChannel socketChannel)
           
 
Method Summary
 void close()
          Closes socket channel.
 void closeInbound()
          Closes inbound.
 void closeOutbound()
          Closes outbound.
 SelectableChannel configureBlocking(boolean b)
           
 boolean connect(SocketAddress socketAddress)
           
 boolean isBlocking()
           
 boolean isConnected()
           
 boolean isOpen()
           
 SelectionKey keyFor(Selector selector)
           
 int read(ByteBuffer byteBuffer)
           
 SelectionKey register(Selector selector, int ops, Object attachment)
           
 Socket socket()
           
 String toString()
           
 int write(ByteBuffer byteBuffer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

socketChannel

protected final SocketChannel socketChannel
Constructor Detail

DefaultSocketChannelWrapper

public DefaultSocketChannelWrapper(SocketChannel socketChannel)
Method Detail

isBlocking

public boolean isBlocking()
Specified by:
isBlocking in interface SocketChannelWrapper

socket

public Socket socket()
Specified by:
socket in interface SocketChannelWrapper

isConnected

public boolean isConnected()
Specified by:
isConnected in interface SocketChannelWrapper

connect

public boolean connect(SocketAddress socketAddress)
                throws IOException
Specified by:
connect in interface SocketChannelWrapper
Throws:
IOException

read

public int read(ByteBuffer byteBuffer)
         throws IOException
Specified by:
read in interface SocketChannelWrapper
Throws:
IOException

write

public int write(ByteBuffer byteBuffer)
          throws IOException
Specified by:
write in interface SocketChannelWrapper
Throws:
IOException

configureBlocking

public SelectableChannel configureBlocking(boolean b)
                                    throws IOException
Specified by:
configureBlocking in interface SocketChannelWrapper
Throws:
IOException

isOpen

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

closeInbound

public void closeInbound()
                  throws IOException
Description copied from interface: SocketChannelWrapper
Closes inbound.

Not thread safe. Should be called in channel reader thread.

Specified by:
closeInbound in interface SocketChannelWrapper
Throws:
IOException

closeOutbound

public void closeOutbound()
                   throws IOException
Description copied from interface: SocketChannelWrapper
Closes outbound.

Not thread safe. Should be called in channel writer thread.

Specified by:
closeOutbound in interface SocketChannelWrapper
Throws:
IOException

close

public void close()
           throws IOException
Description copied from interface: SocketChannelWrapper
Closes socket channel.

Specified by:
close in interface SocketChannelWrapper
Specified by:
close in interface Closeable
Throws:
IOException

keyFor

public SelectionKey keyFor(Selector selector)
Specified by:
keyFor in interface SocketChannelWrapper

register

public SelectionKey register(Selector selector,
                             int ops,
                             Object attachment)
                      throws ClosedChannelException
Specified by:
register in interface SocketChannelWrapper
Throws:
ClosedChannelException

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.