Add javadoc on some methods

This commit is contained in:
Louis Royer 2020-03-21 14:29:29 +01:00
parent ad2b796071
commit 683529b21c
3 changed files with 18 additions and 2 deletions

View File

@ -84,7 +84,7 @@ public class ServerManagementUDP implements Runnable {
Payload p = pd.getPayload();
switch (p.getRequestResponseCode()) {
case LOAD_REQUEST:
loadRequestManagement(p, pd);
loadRequestManagement(pd);
break;
case LIST_REQUEST:
listRequestManagement(pd);
@ -158,7 +158,11 @@ public class ServerManagementUDP implements Runnable {
}
}
public void loadRequestManagement(Payload p, ProtocolP2PPacketUDP pd){
/** Respond to LOAD requests
* @param pd ProtocolP2PPacketUDP
*/
public void loadRequestManagement(ProtocolP2PPacketUDP pd){
Payload p = pd.getPayload();
logger.writeUDP("Received LOAD_REQUEST", LogLevel.Action);
assert p instanceof LoadRequest : "payload must be an instance of LoadRequest";
if (!(p instanceof LoadRequest)) {
@ -208,6 +212,9 @@ public class ServerManagementUDP implements Runnable {
}
}
/** Respond to LIST requests
* @param pd ProtocolP2PPacketUDP
*/
public void listRequestManagement(ProtocolP2PPacketUDP pd) {
logger.writeUDP("Received LIST_REQUEST", LogLevel.Action);
try {

View File

@ -127,6 +127,9 @@ public class HostItem {
return hostname.hashCode() ^ port;
}
/** Get InetAddress associated to this HostItem.
* @return InetAddress
*/
public InetAddress getInetAddress() {
if (inetAddress == null) {
try {
@ -139,6 +142,9 @@ public class HostItem {
return inetAddress;
}
/** Constructor from Socket.
* @param s socket
*/
public HostItem(Socket s) {
tcpSocket = s;
inetAddress = s.getInetAddress();

View File

@ -17,6 +17,9 @@ import java.sql.Timestamp;
public class Logger {
private Path logFile;
/** Constructor with logFile.
* @param logFile name of the file to store logs.
*/
public Logger(String logFile) {
assert logFile != null : "Logfile name is null";
this.logFile = Paths.get(logFile);