List of usage examples for java.lang System identityHashCode
@HotSpotIntrinsicCandidate public static native int identityHashCode(Object x);
From source file:com.medsphere.ovid.common.uuid.KeyGenerator.java
public KeyGenerator() { try {/* w w w .j ava 2 s .co m*/ InetAddress inet = InetAddress.getLocalHost(); byte[] bytes = inet.getAddress(); String inetAddressInHex = new String(Hex.encodeHex(bytes)); String hashCodeForThis = new String(Hex.encodeHex(intToByteArray(System.identityHashCode(this)))); middle = inetAddressInHex + hashCodeForThis; seeder = new SecureRandom(); seeder.nextInt(); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); seeder = new SecureRandom(); seeder.nextInt(); middle = new Integer(this.hashCode()).toString(); } }
From source file:org.grails.datastore.mapping.core.AbstractAttributeStoringSession.java
public void setAttribute(Object entity, String attributeName, Object value) { if (entity == null) { return;//from ww w. ja v a 2s.c o m } int id = System.identityHashCode(entity); Map<String, Object> attrs = attributes.get(id); if (attrs == null) { attrs = new ConcurrentHashMap<String, Object>(); attributes.put(id, attrs); } if (attributeName != null && value != null) { attrs.put(attributeName, value); } }
From source file:ObjectUtils.java
/** * Return a hex String form of an object's identity hash code. * @param obj the object/*from w ww . ja v a 2 s. com*/ * @return the object's identity code in hex notation */ public static String getIdentityHexString(Object obj) { return Integer.toHexString(System.identityHashCode(obj)); }
From source file:org.apache.mahout.common.RandomWrapper.java
RandomWrapper() { random = new MersenneTwister(); random.setSeed(System.currentTimeMillis() + System.identityHashCode(random)); }
From source file:org.nuxeo.ecm.webengine.loader.store.MemoryStore.java
public MemoryStore(Map<String, byte[]> store) { this.store = store; this.location = "java:" + System.identityHashCode(this); }
From source file:com.metamx.cache.CaffeineDruidModule.java
@Override public List<? extends Module> getJacksonModules() { return ImmutableList.of(new SimpleModule("DruidCaffeineCache-" + System.identityHashCode(this)) .registerSubtypes(CaffeineCacheProvider.class)); }
From source file:UuidGenerator.java
/** * Initializes the factory./*from w w w . ja v a 2s .c om*/ * * @param obj */ private synchronized static void initialize(final Object obj) { try { InetAddress inet = InetAddress.getLocalHost(); byte[] bytes = inet.getAddress(); String hexInetAddress = hexFormat(getInt(bytes), 8); String thisHashCode = hexFormat(System.identityHashCode(obj), 8); s_midValue = hexInetAddress + thisHashCode; s_seeder = new SecureRandom(); s_seeder.nextInt(); } catch (java.net.UnknownHostException e) { throw new Error("can not initialize the UuidGenerator generator"); } s_initialized = true; }
From source file:com.arpnetworking.metrics.proxy.models.messages.Command.java
/** * {@inheritDoc}/*from ww w . j a v a 2s. c o m*/ */ @Override public String toString() { return MoreObjects.toStringHelper(this).add("id", Integer.toHexString(System.identityHashCode(this))) .add("class", this.getClass()).add("Command", _command).toString(); }
From source file:org.seasar.caching.interceptor.CallDescription.java
public CallDescription(MethodInvocation invocation) { Method method = invocation.getMethod(); argument = invocation.getArguments(); targetObject = System.identityHashCode(invocation.getThis()); declaredClass = method.getDeclaringClass(); methodName = method.getName();//from ww w.j a va 2 s .c o m methodArguments = method.getParameterTypes(); }
From source file:GUIDGenerator.java
/** * A 32 byte GUID generator (Globally Unique ID). These artificial keys SHOULD <strong>NOT </strong> be seen by the user, * not even touched by the DBA but with very rare exceptions, just manipulated by the database and the programs. * * Usage: Add an id field (type java.lang.String) to your EJB, and add setId(XXXUtil.generateGUID(this)); to the ejbCreate method. *///ww w.j av a2 s . c o m public static final String generateGUID(Object o) { StringBuffer tmpBuffer = new StringBuffer(16); if (hexServerIP == null) { java.net.InetAddress localInetAddress = null; try { localInetAddress = java.net.InetAddress.getLocalHost(); } catch (java.net.UnknownHostException uhe) { return null; } byte serverIP[] = localInetAddress.getAddress(); hexServerIP = hexFormat(getInt(serverIP), 8); } String hashcode = hexFormat(System.identityHashCode(o), 8); tmpBuffer.append(hexServerIP); tmpBuffer.append(hashcode); long timeNow = System.currentTimeMillis(); int timeLow = (int) timeNow & 0xFFFFFFFF; int node = seeder.nextInt(); StringBuffer guid = new StringBuffer(32); guid.append(hexFormat(timeLow, 8)); guid.append(tmpBuffer.toString()); guid.append(hexFormat(node, 8)); return guid.toString(); }