Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,33 +1,27 @@
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 {

private LightCommClient client;
private Map<String, Conn> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down