public class TrackerManagementTCP extends TrackerManagement
Modifier and Type | Class and Description |
---|---|
private class |
TrackerManagementTCP.ClientHandler
Private runnable class allowing to serve one client.
|
Modifier and Type | Field and Description |
---|---|
private java.net.ServerSocket |
socket |
Constructor and Description |
---|
TrackerManagementTCP(HostItem tracker,
Logger logger)
Constructor with port and logger.
|
Modifier and Type | Method and Description |
---|---|
protected void |
closeHostItemSocket(HostItem hostItem)
Close HostItem socket
|
protected <T extends Payload> |
createProtocolP2PPacket(T payload)
Create packets
|
protected java.lang.Object |
getHostItemSocket(HostItem hostItem)
Getter for HostItem socket
|
void |
run()
Implementation of runnable.
|
protected void |
writeLog(java.lang.Exception e,
LogLevel logLevel)
Implementation of writeLog
|
protected void |
writeLog(java.lang.String text,
LogLevel logLevel)
Implementation of writeLog
|
handleDiscover, handleListRequest, handleListResponse, handleRatio, handleRegister, handleRequest, handleSizeRequest, handleUnregister, handleUpdateRatio, setStop
sendEmptyDirectory, sendEmptyFile, sendInternalError, sendNotATracker, sendNotFound, sendUnknownHost
public void run()
protected void writeLog(java.lang.String text, LogLevel logLevel)
writeLog
in class ServeErrors
text
- Text to loglogLevel
- level of loggingprotected void writeLog(java.lang.Exception e, LogLevel logLevel)
writeLog
in class ServeErrors
e
- exception to loglogLevel
- level of loggingprotected <T extends Payload> ProtocolP2PPacket<T> createProtocolP2PPacket(T payload)
createProtocolP2PPacket
in class ServeErrors
payload
- Payloadprotected java.lang.Object getHostItemSocket(HostItem hostItem)
getHostItemSocket
in class TrackerManagement
hostItem
- HostItemprotected void closeHostItemSocket(HostItem hostItem)
closeHostItemSocket
in class TrackerManagement
hostItem
- HostItem