Cleaning up error messages, etc. in Java RMI part
authorrtrimana <rtrimana@uci.edu>
Sat, 28 Jan 2017 19:48:14 +0000 (11:48 -0800)
committerrtrimana <rtrimana@uci.edu>
Sat, 28 Jan 2017 19:48:14 +0000 (11:48 -0800)
iotjava/iotrmi/Java/IoTRMIComm.java
iotjava/iotrmi/Java/IoTRMICommClient.java
iotjava/iotrmi/Java/IoTRMICommServer.java
iotjava/iotrmi/Java/IoTRMIUtil.java

index 685bcc53053ea7ab12e6fe88046196bfb7e6dd55..6840214cc137b6a6744da9b614968e57a7f627f6 100644 (file)
@@ -63,7 +63,7 @@ public abstract class IoTRMIComm {
        /**
         * wakeUpThreadOnMethodCall() wakes up the correct thread when receiving method call
         */
-       public void wakeUpThreadOnMethodCall() {
+       private void wakeUpThreadOnMethodCall() {
 
                Thread thread = new Thread() {
                        public void run() {
@@ -87,7 +87,7 @@ public abstract class IoTRMIComm {
        /**
         * wakeUpThreadOnReturnValue() wakes up the correct thread when receiving return value
         */
-       public void wakeUpThreadOnReturnValue() {
+       private void wakeUpThreadOnReturnValue() {
 
                Thread thread = new Thread() {
                        public void run() {
@@ -115,7 +115,6 @@ public abstract class IoTRMIComm {
 
        /**
         * registerSkeleton() registers the skeleton to be woken up
-
         */
        public synchronized void registerSkeleton(int objectId, AtomicBoolean methodReceived) {
 
index 7b26445c6342ef335e73e9b8fc8beae7aecc69c0..99d0af92095d71b22a2f5b9832ce1a09c18a65e1 100644 (file)
@@ -29,7 +29,6 @@ public class IoTRMICommClient extends IoTRMIComm {
         */
        private IoTSocketClient rmiClientSend;
        private IoTSocketClient rmiClientRecv;
-       private int objectIdCounter = Integer.MAX_VALUE;
 
 
        /**
@@ -66,13 +65,13 @@ public class IoTRMICommClient extends IoTRMIComm {
                                                                System.out.println("Return value packet: " + Arrays.toString(packetBytes));
                                                                returnQueue.offer(packetBytes);
                                                        } else
-                                                               throw new Error("IoTRMIComm: Packet type is unknown: " + packetType);
+                                                               throw new Error("IoTRMICommClient: Packet type is unknown: " + packetType);
                                                } //else
                                                //      Thread.sleep(100);
                                                packetBytes = null;
                                        } catch (Exception ex) {
                                                ex.printStackTrace();
-                                               throw new Error("IoTRMIComm: Error receiving return value bytes on client!");
+                                               throw new Error("IoTRMICommClient: Error receiving return value bytes on client!");
                                        }
                                }
                        }
index bf8d3b59cad2a37e70af8b6e49b0f8afadf8d59e..96032d125969c43b89d308a4533bf932e2015e60 100644 (file)
@@ -66,7 +66,7 @@ public class IoTRMICommServer extends IoTRMIComm {
                                        didServerRecvConnect.set(true);
                                } catch (Exception ex) {
                                        ex.printStackTrace();
-                                       throw new Error("IoTRMIComm: Error receiving return value bytes on client!");
+                                       throw new Error("IoTRMICommServer: Error starting receiver server!");
                                }
                        }
                };
@@ -86,7 +86,7 @@ public class IoTRMICommServer extends IoTRMIComm {
                                        didServerSendConnect.set(true);
                                } catch (Exception ex) {
                                        ex.printStackTrace();
-                                       throw new Error("IoTRMIComm: Error receiving return value bytes on client!");
+                                       throw new Error("IoTRMICommServer: Error starting sender server!");
                                }
                        }
                };
@@ -115,13 +115,13 @@ public class IoTRMICommServer extends IoTRMIComm {
                                                                System.out.println("Return value packet: " + Arrays.toString(packetBytes));
                                                                returnQueue.offer(packetBytes);
                                                        } else
-                                                               throw new Error("IoTRMIComm: Packet type is unknown: " + packetType);
+                                                               throw new Error("IoTRMICommServer: Packet type is unknown: " + packetType);
                                                } //else
                                                //      Thread.sleep(100);
                                                packetBytes = null;
                                        } catch (Exception ex) {
                                                ex.printStackTrace();
-                                               throw new Error("IoTRMIComm: Error receiving return value bytes on client!");
+                                               throw new Error("IoTRMICommServer: Error receiving return value bytes on server!");
                                        }
                                }
                        }
index 59b3a49bfc90223a0ffef7ee5c8fdc2096cabed2..e2bfb18afac602a43de17450d4627ec89a4a1f92 100644 (file)
@@ -57,10 +57,6 @@ public class IoTRMIUtil {
        /**
         * Public static data structure to keep track of multiple skeletons and stubs
         */
-       //public static IoTRMIObject rmiObj;
-       //public static IoTRMICall rmiCall;
-       //public static int objIdCounter = Integer.MAX_VALUE;
-       public static Integer objIdCounter = new Integer(Integer.MAX_VALUE);
        public static Map<Integer,Object> mapStub = new HashMap<Integer,Object>();              // Map object to its stub ID
        public static Map<Object,Object> mapSkel = new HashMap<Object,Object>();                // Map object to its skeleton
        public static Map<Object,Integer> mapSkelId = new HashMap<Object,Integer>();    // Map object to its skeleton ID