Add javadoc on some methods

pull/48/head
Louis Royer 5 years ago
parent ad2b796071
commit 683529b21c

@ -84,7 +84,7 @@ public class ServerManagementUDP implements Runnable {
Payload p = pd.getPayload(); Payload p = pd.getPayload();
switch (p.getRequestResponseCode()) { switch (p.getRequestResponseCode()) {
case LOAD_REQUEST: case LOAD_REQUEST:
loadRequestManagement(p, pd); loadRequestManagement(pd);
break; break;
case LIST_REQUEST: case LIST_REQUEST:
listRequestManagement(pd); 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); logger.writeUDP("Received LOAD_REQUEST", LogLevel.Action);
assert p instanceof LoadRequest : "payload must be an instance of LoadRequest"; assert p instanceof LoadRequest : "payload must be an instance of LoadRequest";
if (!(p instanceof 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) { public void listRequestManagement(ProtocolP2PPacketUDP pd) {
logger.writeUDP("Received LIST_REQUEST", LogLevel.Action); logger.writeUDP("Received LIST_REQUEST", LogLevel.Action);
try { try {

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

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

Loading…
Cancel
Save