From d0975287917a7ef42332db5791144237e11d99b6 Mon Sep 17 00:00:00 2001 From: fwhdzh <1064039735@qq.com> Date: Mon, 6 Apr 2026 17:15:32 +0800 Subject: [PATCH] fix: add some missing exception declaration. --- .../luohaha/paxos/utils/client/ClientImplByLC4J.java | 10 ++-------- .../luohaha/paxos/utils/server/ServerImplByLC4J.java | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/MyPaxos/src/main/java/com/github/luohaha/paxos/utils/client/ClientImplByLC4J.java b/MyPaxos/src/main/java/com/github/luohaha/paxos/utils/client/ClientImplByLC4J.java index 11bbbc8..1424d3a 100644 --- a/MyPaxos/src/main/java/com/github/luohaha/paxos/utils/client/ClientImplByLC4J.java +++ b/MyPaxos/src/main/java/com/github/luohaha/paxos/utils/client/ClientImplByLC4J.java @@ -1,19 +1,13 @@ package com.github.luohaha.paxos.utils.client; import java.io.IOException; -import java.net.UnknownHostException; -import java.nio.channels.ClosedChannelException; import java.util.HashMap; import java.util.Map; -import java.util.Queue; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.LinkedBlockingQueue; import java.util.logging.Level; import com.github.luohaha.client.LightCommClient; import com.github.luohaha.connection.Conn; import com.github.luohaha.exception.ConnectionCloseException; -import com.github.luohaha.inter.OnWrite; import com.github.luohaha.param.ClientParam; public class ClientImplByLC4J implements CommClient { @@ -21,13 +15,13 @@ public class ClientImplByLC4J implements CommClient { private LightCommClient client; private Map addressToConn = new HashMap<>(); - public ClientImplByLC4J(int ioThreadPoolSize) { + public ClientImplByLC4J(int ioThreadPoolSize) throws IOException { // TODO Auto-generated constructor stub this.client = new LightCommClient(ioThreadPoolSize); } @Override - public void sendTo(String ip, int port, byte[] msg) throws ClosedChannelException { + public void sendTo(String ip, int port, byte[] msg) throws IOException { // TODO Auto-generated method stub ClientParam param = new ClientParam(); param.setLogLevel(Level.WARNING); diff --git a/MyPaxos/src/main/java/com/github/luohaha/paxos/utils/server/ServerImplByLC4J.java b/MyPaxos/src/main/java/com/github/luohaha/paxos/utils/server/ServerImplByLC4J.java index 6b8c935..089f198 100644 --- a/MyPaxos/src/main/java/com/github/luohaha/paxos/utils/server/ServerImplByLC4J.java +++ b/MyPaxos/src/main/java/com/github/luohaha/paxos/utils/server/ServerImplByLC4J.java @@ -14,7 +14,7 @@ public class ServerImplByLC4J implements CommServer { private LightCommServer server; private ServerParam serverParam; - public ServerImplByLC4J(int port, int ioThreadPoolSize) { + public ServerImplByLC4J(int port, int ioThreadPoolSize) throws IOException { this.serverParam = new ServerParam("localhost", port); this.serverParam.setLogLevel(Level.WARNING); this.serverParam.setBacklog(128);