X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Ffcp%2FFcpConnection.java;h=858b783b305517c9526eec51b943987ea6e75b0f;hb=b171126719c983b590c51f22eb60a3e0afdf1fb9;hp=2f407858a2591b549d8ede2890b769f32c2e2a6e;hpb=508624458578f01a393f8b44f32b98b40054fdc8;p=jFCPlib.git diff --git a/src/main/java/net/pterodactylus/fcp/FcpConnection.java b/src/main/java/net/pterodactylus/fcp/FcpConnection.java index 2f40785..858b783 100644 --- a/src/main/java/net/pterodactylus/fcp/FcpConnection.java +++ b/src/main/java/net/pterodactylus/fcp/FcpConnection.java @@ -31,6 +31,8 @@ import java.util.HashMap; import java.util.Map; import java.util.logging.Logger; +import net.pterodactylus.util.logging.Logging; + /** * An FCP connection to a Freenet node. * @@ -39,7 +41,7 @@ import java.util.logging.Logger; public class FcpConnection implements Closeable { /** Logger. */ - private static final Logger logger = Logger.getLogger(FcpConnection.class.getName()); + private static final Logger logger = Logging.getLogger(FcpConnection.class.getName()); /** The default port for FCP v2. */ public static final int DEFAULT_PORT = 9481; @@ -66,7 +68,7 @@ public class FcpConnection implements Closeable { private FcpConnectionHandler connectionHandler; /** Incoming message statistics. */ - private Map incomingMessageStatistics = Collections.synchronizedMap(new HashMap()); + private static final Map incomingMessageStatistics = Collections.synchronizedMap(new HashMap()); /** * Creates a new FCP connection to the freenet node running on localhost, @@ -191,9 +193,10 @@ public class FcpConnection implements Closeable { } /** - * Closes the connection. If there is no connection to the node, this method - * does nothing. + * Closes the connection. If there is no connection to the node, this + * method does nothing. */ + @Override public void close() { handleDisconnect(null); } @@ -321,8 +324,8 @@ public class FcpConnection implements Closeable { * Handles a disconnect from the node. * * @param throwable - * The exception that caused the disconnect, or null - * if there was no exception + * The exception that caused the disconnect, or + * null if there was no exception */ synchronized void handleDisconnect(Throwable throwable) { FcpUtils.close(remoteInputStream); @@ -370,8 +373,8 @@ public class FcpConnection implements Closeable { } /** - * A wrapper around an {@link InputStream} that only supplies a limit number - * of bytes from the underlying input stream. + * A wrapper around an {@link InputStream} that only supplies a limit + * number of bytes from the underlying input stream. * * @author David ‘Bombe’ Roden <bombe@freenetproject.org> */ @@ -452,7 +455,7 @@ public class FcpConnection implements Closeable { * @see java.io.FilterInputStream#mark(int) */ @Override - public void mark(int readlimit) { + public synchronized void mark(int readlimit) { /* do nothing. */ } @@ -474,7 +477,7 @@ public class FcpConnection implements Closeable { * @see java.io.FilterInputStream#reset() */ @Override - public void reset() throws IOException { + public synchronized void reset() throws IOException { /* do nothing. */ }