T
- must by AbstractSelectableChannel
and ByteChannel
.public abstract class AbstractNioSender<T extends AbstractSelectableChannel & ByteChannel> extends Object implements ErrorReporter
Modifier and Type | Field and Description |
---|---|
static int |
INITIAL_BUFFER_SIZE
Default initial buffer size
40 x 8192 . |
static String |
PROPERTY_BUFFER_SIZE
Buffer size for transmit buffers.
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractNioSender(ErrorReporter errorReporter,
String host,
int port)
|
Modifier and Type | Method and Description |
---|---|
protected T |
channel() |
void |
close() |
String |
getHost() |
int |
getPort() |
protected boolean |
isConnected() |
protected abstract boolean |
isConnected(T channel) |
boolean |
isShutdown() |
void |
reportError(String message,
Exception e)
Report an error caused by a exception.
|
void |
setChannel(T channel) |
public static final String PROPERTY_BUFFER_SIZE
public static final int INITIAL_BUFFER_SIZE
40 x 8192
.protected AbstractNioSender(ErrorReporter errorReporter, String host, int port) throws UnknownHostException
AbstractNioSender
given ErrorReporter
, host
and port
. Object creation
triggers hostname lookup for early failure.errorReporter
- the error reporter.host
- hostname.port
- port number.UnknownHostException
- if no IP address for the host
could be found, or if a scope_id was specified for
a global IPv6 address.protected boolean isConnected() throws IOException
IOException
protected abstract boolean isConnected(T channel)
protected T channel()
public String getHost()
public int getPort()
public void close()
public boolean isShutdown()
public void reportError(String message, Exception e)
ErrorReporter
reportError
in interface ErrorReporter
message
- the messagee
- the exceptionpublic void setChannel(T channel)
Copyright © 2013–2023. All rights reserved.