public class ConnectionHandler extends Object implements Runnable
DataTap.ClientHandler - one for each connected clientDataTap.ClientHandler| Modifier and Type | Field and Description |
|---|---|
protected int |
bufferSize |
protected List<Connection> |
connections
contains the
DataTap.ClientHandler objects - one for each connected
client |
protected ServerSocket |
connectionSocket
the
ServerSocket that new clients can connect to |
protected boolean |
disconnectSlowClients |
protected boolean |
gzip |
private org.slf4j.Logger |
log |
private ExecutorService |
pool |
protected int |
port |
protected boolean |
running
flag to indicate that the server is active
|
| Constructor and Description |
|---|
ConnectionHandler(ExecutorService pool,
ServerSocket connectionSocket) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Shuts down this
ConnectionHandler.Releases all resources. Once a ConnectionHandler has been closed, it is not available for
further processing (i.e. |
void |
init(int bufferSize,
boolean gzip,
boolean disconnectSlowClients) |
void |
register(Socket socket,
int bufferSize,
boolean gzip,
boolean disconnectSlowClients) |
void |
run()
This methods accepts new client connections and creates a socket
connection for each client in an endless loop
|
void |
unregister(Connection connection) |
void |
write(Data item) |
private final org.slf4j.Logger log
protected boolean running
protected ServerSocket connectionSocket
ServerSocket that new clients can connect toprivate final ExecutorService pool
protected int port
protected int bufferSize
protected boolean gzip
protected boolean disconnectSlowClients
protected final List<Connection> connections
DataTap.ClientHandler objects - one for each connected
clientpublic ConnectionHandler(ExecutorService pool, ServerSocket connectionSocket)
public void init(int bufferSize,
boolean gzip,
boolean disconnectSlowClients)
throws IOException
IOExceptionpublic void register(Socket socket, int bufferSize, boolean gzip, boolean disconnectSlowClients) throws IOException
IOExceptionpublic void unregister(Connection connection)
public void run()
public void close()
ConnectionHandler.ConnectionHandler has been closed, it is not available for
further processing (i.e. can't be reactivated). A new thread needs to be
created.public void write(Data item)
Copyright © 2018. All rights reserved.