X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=iotjava%2Fiotrmi%2FJava%2FIoTRMICommClient.java;h=5c5c728c0373f6e12ca127f2efeb457d3ee40dd3;hb=7e8c0cabb7057ad561adbb8b6cc2a0fd5c41bbf4;hp=3f61ba51e867ad9c9c78213716eda32cac289082;hpb=5bc160f4449b52e721b72b091e1b0c1f1362579b;p=iot2.git diff --git a/iotjava/iotrmi/Java/IoTRMICommClient.java b/iotjava/iotrmi/Java/IoTRMICommClient.java index 3f61ba5..5c5c728 100644 --- a/iotjava/iotrmi/Java/IoTRMICommClient.java +++ b/iotjava/iotrmi/Java/IoTRMICommClient.java @@ -22,7 +22,7 @@ import java.util.concurrent.atomic.AtomicBoolean; * @version 1.0 * @since 2017-01-27 */ -public class IoTRMICommClient extends IoTRMIComm { +public final class IoTRMICommClient extends IoTRMIComm { /** * Class Properties @@ -73,15 +73,12 @@ public class IoTRMICommClient extends IoTRMIComm { if (packetBytes != null) { int packetType = IoTRMIComm.getPacketType(packetBytes); if (packetType == IoTRMIUtil.METHOD_TYPE) { - //System.out.println("Method packet: " + Arrays.toString(packetBytes)); methodQueue.offer(packetBytes); } else if (packetType == IoTRMIUtil.RET_VAL_TYPE) { - //System.out.println("Return value packet: " + Arrays.toString(packetBytes)); returnQueue.offer(packetBytes); } else throw new Error("IoTRMICommClient: Packet type is unknown: " + packetType); - } //else - // Thread.sleep(100); + } packetBytes = null; } catch (Exception ex) { ex.printStackTrace(); @@ -100,14 +97,12 @@ public class IoTRMICommClient extends IoTRMIComm { public synchronized void sendReturnObj(Object retObj, byte[] methodBytes) { // Send back return value - //byte[] retObjBytes = IoTRMIUtil.getObjectBytes(retObj); byte[] retObjBytes = null; if (retObj != null) // Handle nullness retObjBytes = IoTRMIUtil.getObjectBytes(retObj); // Send return value together with OBJECT_ID and METHOD_ID for arbitration int objMethIdLen = IoTRMIUtil.OBJECT_ID_LEN + IoTRMIUtil.METHOD_ID_LEN; int headerLen = objMethIdLen + IoTRMIUtil.PACKET_TYPE_LEN; - //byte[] retAllBytes = new byte[headerLen + retObjBytes.length]; byte[] retAllBytes = null; if (retObj == null) // Handle nullness retAllBytes = new byte[headerLen];