package de.todesbaum.util.freenet.fcp2;
+import static java.util.logging.Logger.getLogger;
+
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
+import java.util.logging.Logger;
import net.pterodactylus.util.io.StreamCopier.ProgressListener;
*/
public class Client implements ConnectionListener {
+ private static final Logger logger = getLogger(Client.class.getName());
+
/** The connection this client operates on. */
private final Connection connection;
public Message readMessage(long maxWaitTime) {
synchronized (messageQueue) {
if (disconnected) {
+ logger.fine("Disconnected.");
return null;
}
if (messageQueue.size() == 0) {
try {
messageQueue.wait(maxWaitTime);
} catch (InterruptedException ie1) {
+ logger.fine("Interrupted.");
}
}
if (messageQueue.size() > 0) {
- return messageQueue.remove(0);
+ Message message = messageQueue.remove(0);
+ logger.fine("Got a message: " + message);
+ return message;
}
}
+ logger.fine("Got no message.");
return null;
}