public abstract class AbstractTcpReader
extends java.lang.Object
implements java.lang.Runnable
Modifier and Type | Field and Description |
---|---|
protected org.slf4j.Logger |
logger |
Constructor and Description |
---|
AbstractTcpReader(int port,
int bufferCapacity,
org.slf4j.Logger logger)
Constructs a new TCP reader.
|
AbstractTcpReader(int port,
int bufferCapacity,
org.slf4j.Logger logger,
boolean respawn)
Constructs a new TCP reader.
|
Modifier and Type | Method and Description |
---|---|
int |
getPort() |
protected abstract boolean |
onBufferReceived(java.nio.ByteBuffer buffer) |
void |
run() |
void |
terminate()
Gracefully terminates this TCP reader.
|
public AbstractTcpReader(int port, int bufferCapacity, org.slf4j.Logger logger)
port
- on which to listen for requestsbufferCapacity
- of the used read bufferlogger
- for notification to users and developerspublic AbstractTcpReader(int port, int bufferCapacity, org.slf4j.Logger logger, boolean respawn)
port
- on which to listen for requestsbufferCapacity
- of the used read bufferlogger
- for notification to users and developersrespawn
- respawn reading after connection is lostpublic final void run()
run
in interface java.lang.Runnable
protected abstract boolean onBufferReceived(java.nio.ByteBuffer buffer)
buffer
- to be read fromtrue
when there were enough bytes to perform the read operation
false
otherwise. In this case, the buffer is reset, compacted, and filled with new content.
public void terminate()
public int getPort()
Copyright 2020 Kieker Project, http://kieker-monitoring.net