/** * Construct a new GUID. */ public GUID() { this.vmid = VMID.getInstance(); this.uid = new UID(); // generate a hash code for this GUID int code = vmid.hashCode(); code ^= uid.hashCode(); hashCode = code; }
/** * Get the VMID for the current virtual machine. * * @return Virtual machine identifier. * */ public synchronized static VMID getInstance() { if (instance == null) { instance = create(); } return instance; }
/** * Create the VMID for the current virtual mahcine. * * @return Virtual machine identifer. */ private static VMID create() { // get the local internet address for the current host byte[] address = getHostAddress(); return new VMID(address, PID.getInstance(), new UID()); } }
public Object createId(StatefulSessionEnterpriseContext ctx) throws Exception { // // jason: could probably use org.jboss.util.collection.CompoundKey here // for better uniqueness based on hashCode and such... // // return new CompoundKey(this.localNodeName, new UID()); // return this.localNodeName + ":" + new UID(); }
public static GUID generateProxyClass(ClassLoader loader, ProxyMixin[] mixins, Class<?>[] interfaces) throws Exception { Class<?> clazz = createProxyClass(loader, mixins, interfaces); GUID guid = new GUID(); synchronized (proxyCache) { proxyCache.put(guid, clazz); } return guid; }
public boolean equals(Object obj) { if (!(obj instanceof DistributedPOJOState)) return false; DistributedPOJOState pojo = (DistributedPOJOState)obj; return guid.equals(pojo.guid); }
/** * Returns a VMID as a string. * * @return VMID as a string. */ public static String asString() { return getInstance().toString(); }
/** * Check if the given object is equal to this GUID. * * <p>A GUID is equal to another GUID if the VMID and UID portions are * equal. * * @param obj Object to test equality with. * @return True if object is equal to this GUID. */ public boolean equals(final Object obj) { if (obj == this) return true; if (obj != null && obj.getClass() == getClass()) { GUID guid = (GUID)obj; return guid.vmid.equals(vmid) && guid.uid.equals(uid); } return false; }
public int hashCode() { return guid.hashCode(); }
/** * Create host name. * * @param unit the deployment unit * @return the host name */ protected String createHost(VFSDeploymentUnit unit) { return (hostNameCreator != null) ? hostNameCreator.createHostName(unit) : GUID.asString(); }
/** * Constructs a remoting client with intended target server specified via the locator and * intended subsystem on server for invocations to be routed to. * * @deprecated This constructor should not be used any more as will no longer take into account * the classloader specified as a parameter. */ public Client(ClassLoader cl, ClientInvoker invoker, String subsystem) throws Exception { this.classloader = cl; this.subsystem = subsystem == null ? null : subsystem.toUpperCase(); this.invoker = invoker; this.sessionId = new GUID().toString(); }
/** * @return A {@link UID}. */ public Object createId(StatefulSessionEnterpriseContext ctx) throws Exception { return new UID(); }
/** * Returns wether we are local to the originating container or not. * * @return true when we have the same GUID */ public boolean isLocal() { return invokerID.equals(Invoker.ID); }
private boolean isLocal() { return key.getGuid().equals(GUID); }