Mercurial > hg > Database > Christie
changeset 115:e1e919f12ed9
update msg-pack
line wrap: on
line diff
--- a/src/main/java/christie/daemon/IncomingTcpConnection.java Fri Nov 30 11:17:06 2018 +0900 +++ b/src/main/java/christie/daemon/IncomingTcpConnection.java Tue Dec 04 14:20:26 2018 +0900 @@ -6,22 +6,32 @@ import christie.datagear.command.CommandType; import christie.datagear.RemoteMessage; +import christie.datagear.command.ConvertedCommand; import christie.datagear.command.RemotePeekCommand; import christie.datagear.command.RemoteTakeCommand; import christie.datagear.dg.MessagePackDataGear; -import org.msgpack.MessagePack; -import org.msgpack.unpacker.Unpacker; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.msgpack.jackson.dataformat.MessagePackFactory; + +//import org.msgpack.MessagePack; +//import org.msgpack.unpacker.Unpacker; + + import java.io.EOFException; import java.io.IOException; +import java.io.InputStream; +import java.nio.ByteBuffer; import java.nio.channels.ClosedChannelException; +import java.nio.channels.SocketChannel; public class IncomingTcpConnection extends Thread { RemoteDataGearManager manager; CodeGearManager cgm; Connection connection; - private MessagePack packer = new MessagePack(); + ObjectMapper objectMapper = new ObjectMapper(new MessagePackFactory()); + //private MessagePack packer = new MessagePack(); public IncomingTcpConnection(Connection connection, CodeGearManager cgm) { this.connection = connection; @@ -33,55 +43,74 @@ } public void run() { - Unpacker unpacker = null; - try { - unpacker = packer.createUnpacker(connection.socket.getInputStream()); + //Unpacker unpacker = null; + //MessageUnpacker unpacker = null; + + /*try { + //unpacker = packer.createUnpacker(connection.socket.getInputStream()); } catch (IOException e) { e.printStackTrace(); } if (unpacker == null) { return; - } + }*/ + + ByteBuffer buf = ByteBuffer.allocate(2048); + SocketChannel channel= connection.socket.getChannel(); + + while (true) { try { - RemoteMessage msg = unpacker.read(RemoteMessage.class); - CommandType type = CommandType.getCommandTypeFromId(msg.type); - byte[] data; + //RemoteMessage msg = unpacker.read(RemoteMessage.class); + + if (channel.read(buf) > 0) { + ConvertedCommand convertedCommand = objectMapper.readValue(buf.array(), ConvertedCommand.class); + RemoteMessage msg = objectMapper.readValue(convertedCommand.getCommand(), RemoteMessage.class); + + CommandType type = CommandType.getCommandTypeFromId(msg.type); + byte[] data; + - switch (type) { - case PUT: - data = new byte[unpacker.readInt()]; - connection.socket.getInputStream().read(data); - try { - MessagePackDataGear dg = new MessagePackDataGear(data, Class.forName(msg.clazz)); - cgm.getLocalDGM().put(msg.key, dg); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } + switch (type) { + case PUT: + //data = new byte[unpacker.readInt()]; + //data = new byte[objectMapper.readValue(connectionInputStream, Integer.class)]; + //connection.socket.getInputStream().read(data); - break; + data = convertedCommand.getData(); + + try { + MessagePackDataGear dg = new MessagePackDataGear(data, Class.forName(msg.clazz)); + cgm.getLocalDGM().put(msg.key, dg); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } - case REMOTEPEEK: - cgm.getLocalDGM().runCommand(new RemotePeekCommand(msg, connection)); - break; - case REMOTETAKE: - cgm.getLocalDGM().runCommand(new RemoteTakeCommand(msg, connection)); + break; - break; - case REPLY://待っていたwaitListに渡してcsにセット - data = new byte[unpacker.readInt()]; - connection.socket.getInputStream().read(data); + case REMOTEPEEK: + cgm.getLocalDGM().runCommand(new RemotePeekCommand(msg, connection)); + break; + case REMOTETAKE: + cgm.getLocalDGM().runCommand(new RemoteTakeCommand(msg, connection)); - try { - MessagePackDataGear dg = new MessagePackDataGear(data, Class.forName(msg.clazz)); - cgm.getDGM(msg.fromDgmName).resolveWaitCommand(msg.key, dg); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } + break; + case REPLY://待っていたwaitListに渡してcsにセット + //data = new byte[objectMapper.readValue(convertedCommand, Integer.class)]; + //connection.socket.getInputStream().read(data); + data = convertedCommand.getData(); + try { + MessagePackDataGear dg = new MessagePackDataGear(data, Class.forName(msg.clazz)); + cgm.getDGM(msg.fromDgmName).resolveWaitCommand(msg.key, dg); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } - break; - default: - break; + break; + default: + break; + } + buf.clear(); } } catch (ClosedChannelException e) { return;
--- a/src/main/java/christie/datagear/Command/Command.java Fri Nov 30 11:17:06 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -package christie.datagear.command; - -import christie.codegear.CodeGear; -import christie.daemon.Connection; -import christie.datagear.dg.DataGear; -import christie.datagear.RemoteMessage; - -import java.nio.ByteBuffer; - -public abstract class Command { - public CommandType type; - public String key; - public String toDgmName;// for take - public String fromDgmName = "local";//for remotetake/reply - public int cgmID = 0;// for local meta - public CodeGear cg = null;//for localtake - public DataGear dg = null;//for put/localtake/reply - public Class clazz = null;// for remote - public Connection connection = null;//for reply - - //for remote - public abstract ByteBuffer convert(); - - //for remote - public RemoteMessage createRemoteMessage(){ - return new RemoteMessage(type.id, fromDgmName, key, clazz.getName()); - } - - public void setInputs(){ - cg.getIdg().setInputs(key, dg); - } - - public void setDg(Object obj){ - this.dg.setData(obj); - } - -}
--- a/src/main/java/christie/datagear/Command/CommandType.java Fri Nov 30 11:17:06 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -package christie.datagear.command; - -import java.util.HashMap; - -public enum CommandType { - PUT, - TAKE, - PEEK, - REMOTETAKE, - REMOTEPEEK, - REPLY, - CLOSE, - FINISH; - - public int id;//コマンドのid - public static HashMap<Integer, CommandType> hash = new HashMap<Integer, CommandType>();//コマンド対応表 - private static int lastId = 0;//コマンドの総数 - - private CommandType() { - this.id = incrementLastId(); - }//for init - - private int incrementLastId() { - return ++lastId; - } - - public static CommandType getCommandTypeFromId(int id) { - return hash.get(id); - } - - static { - for (CommandType type : CommandType.values()) { - hash.put(type.id, type); - } - } -}
--- a/src/main/java/christie/datagear/Command/PeekCommand.java Fri Nov 30 11:17:06 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -package christie.datagear.command; - -import christie.codegear.CodeGear; -import christie.datagear.dg.DataGear; - -public class PeekCommand extends TakeCommand{ - public PeekCommand(CodeGear cg, int cgmID, String toDgmName, String key, DataGear dg) { - super(cg, cgmID, toDgmName, key, dg); - this.type = CommandType.PEEK; - } -}
--- a/src/main/java/christie/datagear/Command/PutCommand.java Fri Nov 30 11:17:06 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -package christie.datagear.command; - -import christie.datagear.dg.DataGear; -import christie.datagear.dg.MessagePackDataGear; -import org.msgpack.MessagePack; - -import java.io.IOException; -import java.nio.ByteBuffer; - -public class PutCommand extends Command { - - public PutCommand(int cgmID, String toDgmName, String key, DataGear dg){ - this.type = CommandType.PUT; - this.cgmID = cgmID; - this.toDgmName = toDgmName; - this.key = key; - this.dg = dg; - this.clazz = dg.getClazz(); - } - - @Override - public ByteBuffer convert() { - ByteBuffer buf = null; - MessagePack packer = new MessagePack(); - - try { - byte[] command = packer.write(createRemoteMessage()); - byte[] data = new MessagePackDataGear(dg.getData()).getMessagePack(); - byte[] dataSize = packer.write(data.length); - - buf = ByteBuffer.allocate(command.length+dataSize.length+data.length); - buf.put(command); - buf.put(dataSize); - buf.put(data); - - buf.flip(); - } catch (IOException e) { - e.printStackTrace(); - } - - return buf; - } -}
--- a/src/main/java/christie/datagear/Command/RemotePeekCommand.java Fri Nov 30 11:17:06 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -package christie.datagear.command; - -import christie.daemon.Connection; -import christie.datagear.RemoteMessage; - -public class RemotePeekCommand extends RemoteTakeCommand { - public RemotePeekCommand(RemoteMessage msg, Connection cn) { - super(msg, cn); - this.type = CommandType.REMOTEPEEK; - } - - public RemotePeekCommand(String fromDgmName, Command cm, Connection cn) { - super(fromDgmName, cm, cn); - this.type = CommandType.REMOTEPEEK; - } -}
--- a/src/main/java/christie/datagear/Command/RemoteTakeCommand.java Fri Nov 30 11:17:06 2018 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -package christie.datagear.command; - -import christie.daemon.Connection; -import christie.datagear.RemoteMessage; -import christie.datagear.dg.MessagePackDataGear; -import org.msgpack.MessagePack; - -import java.io.IOException; -import java.nio.ByteBuffer; - -public class RemoteTakeCommand extends Command { - - public RemoteTakeCommand(RemoteMessage msg, Connection cn) { - this.type = CommandType.REMOTETAKE; - this.fromDgmName = msg.fromDgmName; - this.key = msg.key; - try { - this.clazz = Class.forName(msg.clazz); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } - this.dg = new MessagePackDataGear(this.clazz); - this.connection = cn; - } - - public RemoteTakeCommand(String fromDgmName, Command cm, Connection cn) { - this.type = CommandType.REMOTETAKE; - this.fromDgmName = fromDgmName; - this.key = cm.key; - this.clazz = cm.clazz; - this.dg = new MessagePackDataGear(clazz); - this.connection = cn; - } - - @Override - public ByteBuffer convert() { - ByteBuffer buf = null; - MessagePack packer = new MessagePack(); - - try { - byte[] command = packer.write(createRemoteMessage()); - buf = ByteBuffer.allocate(command.length); - buf.put(command); - - buf.flip(); - } catch (IOException e) { - e.printStackTrace(); - } - - return buf; - } -}
--- a/src/main/java/christie/datagear/DataGears.java Fri Nov 30 11:17:06 2018 +0900 +++ b/src/main/java/christie/datagear/DataGears.java Tue Dec 04 14:20:26 2018 +0900 @@ -4,6 +4,7 @@ import java.util.TreeMap; import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.SynchronousQueue; public class DataGears { protected TreeMap<String, LinkedBlockingQueue<DataGear>> dataGears = new TreeMap<String, LinkedBlockingQueue<DataGear>>();
--- a/src/main/java/christie/datagear/RemoteMessage.java Fri Nov 30 11:17:06 2018 +0900 +++ b/src/main/java/christie/datagear/RemoteMessage.java Tue Dec 04 14:20:26 2018 +0900 @@ -1,8 +1,5 @@ package christie.datagear; -import org.msgpack.annotation.Message; - -@Message public class RemoteMessage { public int type;//PUT, PEEKなどのコマンドタイプ public String fromDgmName;//送り元のdsmName。REPLYのときに使用。
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/christie/datagear/command/ConvertedCommand.java Tue Dec 04 14:20:26 2018 +0900 @@ -0,0 +1,28 @@ +package christie.datagear.command; + + +public class ConvertedCommand { + byte[] command; + byte[] dataSize; + byte[] data; + + public ConvertedCommand(){} + + public ConvertedCommand(byte[] command, byte[] dataSize, byte[] data){ + this.command = command; + this.data = data; + this.dataSize = dataSize; + } + + public byte[] getCommand() { + return command; + } + + public byte[] getData() { + return data; + } + + public byte[] getDataSize() { + return dataSize; + } +}
--- a/src/main/java/christie/datagear/command/PutCommand.java Fri Nov 30 11:17:06 2018 +0900 +++ b/src/main/java/christie/datagear/command/PutCommand.java Tue Dec 04 14:20:26 2018 +0900 @@ -4,7 +4,8 @@ import christie.datagear.command.CommandType; import christie.datagear.dg.DataGear; import christie.datagear.dg.MessagePackDataGear; -import org.msgpack.MessagePack; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.msgpack.jackson.dataformat.MessagePackFactory; import java.io.IOException; import java.nio.ByteBuffer; @@ -20,22 +21,56 @@ this.clazz = dg.getClazz(); } + /* @Override public ByteBuffer convert() { ByteBuffer buf = null; - MessagePack packer = new MessagePack(); + //MessagePack packer = new MessagePack(); + + ObjectMapper objectMapper = new ObjectMapper(new MessagePackFactory()); + try { - byte[] command = packer.write(createRemoteMessage()); + //byte[] command = packer.write(createRemoteMessage()); + byte[] command = objectMapper.writeValueAsBytes(createRemoteMessage()); byte[] data = new MessagePackDataGear(dg.getData()).getMessagePack(); - byte[] dataSize = packer.write(data.length); + //byte[] dataSize = packer.write(data.length); + byte[] dataSize = objectMapper.writeValueAsBytes(data.length); + buf = ByteBuffer.allocate(command.length+dataSize.length+data.length); buf.put(command); buf.put(dataSize); buf.put(data); + buf.flip(); + } catch (IOException e) { + e.printStackTrace(); + } + + return buf; + }*/ + @Override + public ByteBuffer convert() { + ByteBuffer buf = null; + //MessagePack packer = new MessagePack(); + + ObjectMapper objectMapper = new ObjectMapper(new MessagePackFactory()); + //objectMapper.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL); + + try { + //byte[] command = packer.write(createRemoteMessage()); + byte[] command = objectMapper.writeValueAsBytes(createRemoteMessage()); + byte[] data = new MessagePackDataGear(dg.getData()).getMessagePack(); + //byte[] dataSize = packer.write(data.length); + byte[] dataSize = objectMapper.writeValueAsBytes(data.length); + + ConvertedCommand convertedCommand = new ConvertedCommand(command, dataSize, data); + byte[] byteCommand = objectMapper.writeValueAsBytes(convertedCommand); + buf = ByteBuffer.allocate(byteCommand.length); + buf.put(byteCommand); buf.flip(); + } catch (IOException e) { e.printStackTrace(); }
--- a/src/main/java/christie/datagear/command/RemoteTakeCommand.java Fri Nov 30 11:17:06 2018 +0900 +++ b/src/main/java/christie/datagear/command/RemoteTakeCommand.java Tue Dec 04 14:20:26 2018 +0900 @@ -5,7 +5,8 @@ import christie.datagear.command.Command; import christie.datagear.command.CommandType; import christie.datagear.dg.MessagePackDataGear; -import org.msgpack.MessagePack; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.msgpack.jackson.dataformat.MessagePackFactory; import java.io.IOException; import java.nio.ByteBuffer; @@ -37,12 +38,22 @@ @Override public ByteBuffer convert() { ByteBuffer buf = null; - MessagePack packer = new MessagePack(); + ObjectMapper objectMapper = new ObjectMapper(new MessagePackFactory()); + + //MessagePack packer = new MessagePack(); try { - byte[] command = packer.write(createRemoteMessage()); - buf = ByteBuffer.allocate(command.length); - buf.put(command); + //byte[] command = packer.write(createRemoteMessage()); + + byte[] command = objectMapper.writeValueAsBytes(createRemoteMessage()); + ConvertedCommand convertedCommand = new ConvertedCommand(command, null, null); + + byte[] byteCommand = objectMapper.writeValueAsBytes(convertedCommand); + + buf = ByteBuffer.allocate(byteCommand.length); + buf.put(byteCommand); + //buf = ByteBuffer.allocate(command.length); + //buf.put(command); buf.flip(); } catch (IOException e) {
--- a/src/main/java/christie/datagear/dg/MessagePackDataGear.java Fri Nov 30 11:17:06 2018 +0900 +++ b/src/main/java/christie/datagear/dg/MessagePackDataGear.java Tue Dec 04 14:20:26 2018 +0900 @@ -1,13 +1,18 @@ package christie.datagear.dg; -import org.msgpack.MessagePack; +//import org.msgpack.MessagePack; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.msgpack.jackson.dataformat.MessagePackFactory; + import java.io.IOException; public class MessagePackDataGear<T> extends DataGear {//必ずmessagePack形式を持つDataGear private byte[] messagePack = null; private int dataSize; - private MessagePack packer = new MessagePack(); + //private MessagePack packer = new MessagePack(); + ObjectMapper objectMapper = new ObjectMapper(new MessagePackFactory()); + public MessagePackDataGear(T data){ super(data); @@ -28,7 +33,7 @@ return messagePack; } else { try { - messagePack = packer.write(data); + messagePack = objectMapper.writeValueAsBytes(data); setDataSize(messagePack.length); } catch (IOException e) { e.printStackTrace(); @@ -41,7 +46,7 @@ public synchronized T getData(){ if (data == null){ try { - setData(packer.read(messagePack, clazz)); + setData(objectMapper.readValue(messagePack, clazz)); } catch (IOException e) { e.printStackTrace(); }
--- a/src/main/java/christie/test/Paxos/PromiseCodeGear.java Fri Nov 30 11:17:06 2018 +0900 +++ b/src/main/java/christie/test/Paxos/PromiseCodeGear.java Tue Dec 04 14:20:26 2018 +0900 @@ -15,18 +15,18 @@ @Take Proposal prepareProposal; + public PromiseCodeGear(){ } - - @Override protected void run(CodeGearManager cgm) { if(promisedProposal.getNumber() < prepareProposal.getNumber()) { + String proposerName= prepareProposal.getProposerName(); System.out.println("promised < prepare : " + promisedProposal.getNumber() + " < " + prepareProposal.getNumber()); - System.out.println("Acceptor" + cgm.cgmID + " Recive Proposal from : " + prepareProposal.getCgmID()); - put("promisedProposal", prepareProposal); - cgm.getCgmList().get(prepareProposal.getCgmID()).getLocalDGM().put("recievePromise", prepareProposal); + System.out.println("Acceptor" + cgm.cgmID + " Recive Proposal from : " + proposerName); + getLocalDGM().put("promisedProposal", prepareProposal); + getDGM(proposerName).put("recievePromise", prepareProposal); //cgm.setup(new AcceptCodeGear()); }else { put("promisedProposal", promisedProposal);
--- a/src/main/java/christie/test/Paxos/Proposal.java Fri Nov 30 11:17:06 2018 +0900 +++ b/src/main/java/christie/test/Paxos/Proposal.java Tue Dec 04 14:20:26 2018 +0900 @@ -1,31 +1,27 @@ package christie.test.Paxos; import christie.codegear.CodeGearManager; -import org.msgpack.annotation.Message; -@Message public class Proposal { - private int cgmNum = 0; - private int cgmID = 0; + private String proposerName = ""; + private int nodeNum = 0; private int number = 0; private int value = 0; + private int id = 0; - public Proposal(){} + public Proposal(){ - + } - public Proposal(CodeGearManager cgm, int value){ - - this.cgmNum = cgm.getCgmList().size(); - this.cgmID = cgm.cgmID; - + public Proposal(String proposerName, int nodeNum, int value, int id){ + this.proposerName = proposerName; + this.nodeNum = nodeNum; this.value = value; + this.id = id; incrementNumber(); } - - public void setValue(int value){ this.value = value; } @@ -35,7 +31,7 @@ } public int incrementNumber() { - this.number += cgmNum + cgmID; + this.number += nodeNum + id; return this.number; } @@ -44,9 +40,7 @@ return this; } - public int getCgmID(){ - return this.cgmID; + public String getProposerName() { + return proposerName; } - - }
--- a/src/main/java/christie/test/Paxos/ProposerCodeGear.java Fri Nov 30 11:17:06 2018 +0900 +++ b/src/main/java/christie/test/Paxos/ProposerCodeGear.java Tue Dec 04 14:20:26 2018 +0900 @@ -4,18 +4,18 @@ import christie.codegear.CodeGear; import christie.codegear.CodeGearManager; import christie.datagear.DataGearManager; -import java.util.concurrent.ConcurrentHashMap; + +import java.util.HashMap; public class ProposerCodeGear extends CodeGear { - ConcurrentHashMap<String, DataGearManager> acceptors; + HashMap<String, DataGearManager> acceptors; @Override protected void run(CodeGearManager cgm) { cgm.setup(new SendPrepareRequestCodeGear()); - //put("acceptors", cgm.getRemoteDgmList()); - put("sendProposal", new Proposal(cgm,cgm.cgmID)); + put("sendProposal", new Proposal()); put("promiseCount", 0); }
--- a/src/main/java/christie/test/Paxos/SendPrepareRequestCodeGear.java Fri Nov 30 11:17:06 2018 +0900 +++ b/src/main/java/christie/test/Paxos/SendPrepareRequestCodeGear.java Tue Dec 04 14:20:26 2018 +0900 @@ -6,11 +6,12 @@ import christie.codegear.CodeGearManager; import christie.datagear.DataGearManager; +import java.util.HashMap; import java.util.concurrent.ConcurrentHashMap; public class SendPrepareRequestCodeGear extends CodeGear{ @Peek - ConcurrentHashMap<String, DataGearManager> acceptors; + HashMap<String, DataGearManager> acceptors; @Take Proposal sendProposal;
--- a/src/main/java/christie/test/Paxos/StartPaxos.java Fri Nov 30 11:17:06 2018 +0900 +++ b/src/main/java/christie/test/Paxos/StartPaxos.java Tue Dec 04 14:20:26 2018 +0900 @@ -5,6 +5,7 @@ import christie.codegear.StartCodeGear; import java.util.ArrayList; +import java.util.HashMap; public class StartPaxos extends StartCodeGear{ @@ -19,18 +20,26 @@ int acceptor_port = proposer_port + proposers_num; int acceptors_num = 3; - ArrayList<CodeGearManager> proposers = new ArrayList<CodeGearManager>(); - ArrayList<CodeGearManager> acceptors = new ArrayList<CodeGearManager>(); + + + HashMap<String, CodeGearManager> proposers = new HashMap<>(); + HashMap<String, CodeGearManager> acceptors = new HashMap<>(); for(int i = 0; i < acceptors_num; i++){ CodeGearManager acceptor = createCGM(acceptor_port + i); + String nodeName = "acceptor" + i; + acceptor.getLocalDGM().put("nodeName", nodeName); acceptor.setup(new AcceptorCodeGear()); - acceptors.add(acceptor); + acceptors.put(nodeName, acceptor); } for(int i = 0; i < proposers_num; i++){ - proposers.add(createCGM(proposer_port + i)); + String nodeName = "proposer" + i; + CodeGearManager proposer = createCGM(proposer_port + i); + proposer.getLocalDGM().put("nodeName", "proposer" + i); + proposer.getLocalDGM().put("nodeNum", proposers_num + acceptors_num); + proposers.put(nodeName, proposer); }
--- a/src/main/java/christie/topology/HostMessage.java Fri Nov 30 11:17:06 2018 +0900 +++ b/src/main/java/christie/topology/HostMessage.java Tue Dec 04 14:20:26 2018 +0900 @@ -1,12 +1,9 @@ package christie.topology; - -import org.msgpack.annotation.Message; - import java.net.InetAddress; import java.net.UnknownHostException; -@Message + public class HostMessage { private String hostName; private int port; @@ -18,7 +15,7 @@ private boolean alive; - public HostMessage() { } + public HostMessage() {} public void setLocalHostAndPort(int port){ try {