public abstract class NIOSocketTransport extends Object implements NIOTransport
Modifier and Type | Field and Description |
---|---|
static String |
BLOCKING_SOCKETS_FLAG |
protected boolean |
isBlocking |
protected SelectionKey |
readSelectionKey |
protected Selector |
readSelector |
protected int |
receiveBufferSize |
protected int |
sendBufferSize |
protected Socket |
socket |
static int |
SOCKET_READ_SIZE |
protected SocketChannel |
socketChannel |
static String |
SPINNING_READ_FLAG |
protected boolean |
useSpinningReadSelect |
protected SelectionKey |
writeSelectionKey |
protected Selector |
writeSelector |
Modifier | Constructor and Description |
---|---|
protected |
NIOSocketTransport(int sendBufferSize,
int receiveBufferSize) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the transport.
|
String |
getAddress()
Getter for address value.
|
InetAddress |
getInetAddress()
Getter for address value.
|
int |
getLocalPort()
Getter for local port value.
|
int |
getPort()
Getter for port value.
|
Certificate[] |
getSSLCertificates()
Getter for certificates from session
|
String |
getSSLCipherSuite()
Getter for cipher suite from session
|
String |
getSSLProtocol()
Getter for ssl protocol from session
|
boolean |
isBlockingSocket() |
boolean |
isOpen()
Returns true if, transport is open.
|
abstract void |
open()
Open the transport.
|
int |
read(byte[] buffer)
Transport dependent read method.
|
int |
read(byte[] buffer,
int offset,
int length)
Transport dependent read method.
|
int |
read(ByteBuffer buffer) |
int |
read(ByteBuffer buffer,
int offset,
int length) |
void |
setSessionConnectivityParams(Map<String,Object> connectivityParams) |
void |
waitUntilReadyToWrite() |
void |
write(byte[] message)
Transport dependent write method.
|
int |
write(byte[] buffer,
int offset,
int length)
Transport dependent write method.
|
int |
write(ByteBuffer buffer) |
int |
write(ByteBuffer buffer,
int offset,
int length) |
public static final int SOCKET_READ_SIZE
public static final String BLOCKING_SOCKETS_FLAG
public static final String SPINNING_READ_FLAG
protected Socket socket
protected int sendBufferSize
protected int receiveBufferSize
protected Selector readSelector
protected Selector writeSelector
protected SocketChannel socketChannel
protected SelectionKey readSelectionKey
protected SelectionKey writeSelectionKey
protected boolean isBlocking
protected boolean useSpinningReadSelect
protected NIOSocketTransport(int sendBufferSize, int receiveBufferSize)
public void setSessionConnectivityParams(Map<String,Object> connectivityParams)
setSessionConnectivityParams
in interface NIOTransport
public boolean isBlockingSocket()
isBlockingSocket
in interface Transport
public int write(ByteBuffer buffer) throws IOException
write
in interface Transport
IOException
public void waitUntilReadyToWrite() throws IOException
waitUntilReadyToWrite
in interface Transport
IOException
public final int write(byte[] buffer, int offset, int length) throws IOException
Transport
write
in interface Transport
buffer
- actual messageoffset
- the offset in bufferlength
- the num of bytes to writeIOException
- if unable to writepublic final int write(ByteBuffer buffer, int offset, int length) throws IOException
write
in interface Transport
IOException
public final int read(ByteBuffer buffer, int offset, int length) throws IOException
read
in interface Transport
IOException
public final int read(ByteBuffer buffer) throws IOException
read
in interface Transport
IOException
public int read(byte[] buffer, int offset, int length) throws IOException
Transport
read
in interface Transport
buffer
- holder for read bytesoffset
- in bufferlength
- maximum bytes to be readIOException
- if unable to readTransport.read(byte[], int, int)
public int read(byte[] buffer) throws IOException
Transport
read
in interface Transport
buffer
- holder for read bytesIOException
- if unable to readTransport.read(byte[])
public void write(byte[] message) throws IOException
Transport
write
in interface Transport
message
- actual messageIOException
- if unable to writeTransport.write(byte[])
public String getAddress()
Transport
getAddress
in interface Transport
Transport.getAddress()
public InetAddress getInetAddress()
Transport
getInetAddress
in interface Transport
public int getPort()
Transport
getPort
in interface Transport
Transport.getPort()
public int getLocalPort()
Transport
getLocalPort
in interface Transport
public void close() throws IOException
Transport
close
in interface Transport
IOException
- - throws if error occurredTransport.close()
public abstract void open() throws IOException
Transport
open
in interface Transport
IOException
- - throws if error occurredTransport.open()
public boolean isOpen()
Transport
isOpen
in interface Transport
Transport.isOpen()
public String getSSLProtocol()
Transport
getSSLProtocol
in interface Transport
public String getSSLCipherSuite()
Transport
getSSLCipherSuite
in interface Transport
public Certificate[] getSSLCertificates()
Transport
getSSLCertificates
in interface Transport
Copyright © 2000–2022 EPAM Systems. All rights reserved.