1 31 package org.objectweb.proactive.core; 32 33 import org.apache.log4j.Logger; 34 35 47 public class UniqueID implements java.io.Serializable { 48 49 private java.rmi.server.UID id; 50 private java.rmi.dgc.VMID vmID; 51 52 private static java.rmi.dgc.VMID uniqueVMID = new java.rmi.dgc.VMID (); 54 protected static Logger logger = Logger.getLogger(UniqueID.class.getName()); 55 59 62 public UniqueID() { 63 this.id = new java.rmi.server.UID (); 64 this.vmID = uniqueVMID; 65 } 66 67 68 72 76 public static java.rmi.dgc.VMID getCurrentVMID() { 77 return uniqueVMID; 78 } 79 80 81 82 86 92 public java.rmi.dgc.VMID getVMID() { 93 return vmID; 94 } 95 96 97 101 public java.rmi.server.UID getUID() { 102 return id; 103 } 104 105 106 110 public String toString() { 111 return "" + id + " " + vmID; 112 } 113 114 115 119 public int hashCode() { 120 return id.hashCode() + vmID.hashCode(); 121 } 122 123 124 128 public boolean equals(Object o) { 129 if (o instanceof UniqueID) { 131 return ((id.equals(((UniqueID)o).id)) && (vmID.equals(((UniqueID)o).vmID))); 132 } else 133 return false; 134 } 135 136 137 140 public void echo() { 141 logger.info("UniqueID The Id is " + id + " and the address is " + vmID); 142 } 143 144 145 } 146 147 148 | Popular Tags |