src/share/classes/java/rmi/dgc/VMID.java

Print this page




 101             if (addr != null) {
 102                 if (addr.length != vmid.addr.length)
 103                     return false;
 104                 for (int i = 0; i < addr.length; ++ i)
 105                     if (addr[i] != vmid.addr[i])
 106                         return false;
 107             }
 108             return true;
 109         } else {
 110             return false;
 111         }
 112     }
 113 
 114     /**
 115      * Return string representation of this VMID.
 116      */
 117     public String toString() {
 118         StringBuffer result = new StringBuffer();
 119         if (addr != null)
 120             for (int i = 0; i < addr.length; ++ i) {
 121                 int x = (int) (addr[i] & 0xFF);
 122                 result.append((x < 0x10 ? "0" : "") +
 123                               Integer.toString(x, 16));
 124             }
 125         result.append(':');
 126         result.append(uid.toString());
 127         return result.toString();
 128     }
 129 
 130     /**
 131      * Compute the hash an IP address.  The hash is the first 8 bytes
 132      * of the SHA digest of the IP address.
 133      */
 134     private static byte[] computeAddressHash() {
 135 
 136         /*
 137          * Get the local host's IP address.
 138          */
 139         byte[] addr = java.security.AccessController.doPrivileged(
 140             new PrivilegedAction<byte[]>() {
 141             public byte[] run() {




 101             if (addr != null) {
 102                 if (addr.length != vmid.addr.length)
 103                     return false;
 104                 for (int i = 0; i < addr.length; ++ i)
 105                     if (addr[i] != vmid.addr[i])
 106                         return false;
 107             }
 108             return true;
 109         } else {
 110             return false;
 111         }
 112     }
 113 
 114     /**
 115      * Return string representation of this VMID.
 116      */
 117     public String toString() {
 118         StringBuffer result = new StringBuffer();
 119         if (addr != null)
 120             for (int i = 0; i < addr.length; ++ i) {
 121                 int x = addr[i] & 0xFF;
 122                 result.append((x < 0x10 ? "0" : "") +
 123                               Integer.toString(x, 16));
 124             }
 125         result.append(':');
 126         result.append(uid.toString());
 127         return result.toString();
 128     }
 129 
 130     /**
 131      * Compute the hash an IP address.  The hash is the first 8 bytes
 132      * of the SHA digest of the IP address.
 133      */
 134     private static byte[] computeAddressHash() {
 135 
 136         /*
 137          * Get the local host's IP address.
 138          */
 139         byte[] addr = java.security.AccessController.doPrivileged(
 140             new PrivilegedAction<byte[]>() {
 141             public byte[] run() {