Example usage for java.lang System identityHashCode

List of usage examples for java.lang System identityHashCode

Introduction

In this page you can find the example usage for java.lang System identityHashCode.

Prototype

@HotSpotIntrinsicCandidate
public static native int identityHashCode(Object x);

Source Link

Document

Returns the same hash code for the given object as would be returned by the default method hashCode(), whether or not the given object's class overrides hashCode().

Usage

From source file:com.asta.app2.tutorial.helloorchestra.ReservationView.java

public int getInstanceId() {
    return System.identityHashCode(this);
}

From source file:nu.yona.server.rest.PolymorphicDto.java

@Override
public int hashCode() {
    return System.identityHashCode(this);
}

From source file:org.apache.kylin.source.kafka.config.KafkaConsumerProperties.java

public static KafkaConsumerProperties getInstanceFromEnv() {
    synchronized (KafkaConsumerProperties.class) {
        if (ENV_INSTANCE == null) {
            try {
                KafkaConsumerProperties config = new KafkaConsumerProperties();
                config.properties = config.loadKafkaConsumerProperties();

                logger.info("Initialized a new KafkaConsumerProperties from getInstanceFromEnv : "
                        + System.identityHashCode(config));
                ENV_INSTANCE = config;//w w w .j av  a2 s.co  m
            } catch (IllegalArgumentException e) {
                throw new IllegalStateException("Failed to find KafkaConsumerProperties ", e);
            }
        }
        return ENV_INSTANCE;
    }
}

From source file:at.ac.tuwien.infosys.jcloudscale.utility.ReferenceHashmap.java

@SuppressWarnings("unchecked")
@Override//w  w  w .j ava  2  s.com
public boolean containsKey(Object key) {
    List<WeakReference<K>> _keys = keys.get(System.identityHashCode(key));
    if (_keys == null)
        return false;
    return containsKey(_keys, (K) key);
}

From source file:org.projectforge.common.ReflectionToString.java

public ReflectionToString(Object arg0) {
    super(Hibernate.isInitialized(arg0) ? arg0
            : "Lazy" + arg0.getClass() + "@" + System.identityHashCode(arg0));
}

From source file:org.recommender101.recommender.extensions.mahout.impl.random.RandomWrapper.java

RandomWrapper() {
    synchronized (syncer) {
        random = new MersenneTwister();
        random.setSeed(System.nanoTime() + System.identityHashCode(random));
    }

}

From source file:com.arpnetworking.metrics.proxy.models.messages.MetricsList.java

/**
 * {@inheritDoc}//from ww w  . java  2 s  . c  o m
 */
@Override
public String toString() {
    return MoreObjects.toStringHelper(this).add("id", Integer.toHexString(System.identityHashCode(this)))
            .add("class", this.getClass()).add("Metrics", _metrics).toString();
}

From source file:org.apache.hadoop.hdfs.TestWriteConfigurationToDFS.java

@Test(timeout = 600000)
public void testWriteConf() throws Exception {
    Configuration conf = new HdfsConfiguration();
    conf.setInt(DFSConfigKeys.DFS_BLOCK_SIZE_KEY, 4096);
    LOG.info("Setting conf in: " + System.identityHashCode(conf));
    MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(1).build();
    FileSystem fs = null;/*from www .  j  av a 2s.  c  o m*/
    OutputStream os = null;
    try {
        fs = cluster.getFileSystem();
        Path filePath = new Path("/testWriteConf.xml");
        os = fs.create(filePath);
        StringBuilder longString = new StringBuilder();
        for (int i = 0; i < 100000; i++) {
            longString.append("hello");
        } // 500KB
        conf.set("foobar", longString.toString());
        conf.writeXml(os);
        os.close();
        os = null;
        fs.close();
        fs = null;
    } finally {
        IOUtils.cleanup(null, os, fs);
        cluster.shutdown();
    }
}

From source file:org.projectforge.framework.persistence.utils.ReflectionToString.java

public ReflectionToString(final Object arg0) {
    super(Hibernate.isInitialized(arg0) ? arg0
            : "Lazy" + arg0.getClass() + "@" + System.identityHashCode(arg0));
}

From source file:org.grails.datastore.mapping.core.AbstractAttributeStoringSession.java

public Object getAttribute(Object entity, String attributeName) {
    if (entity == null) {
        return null;
    }/* w  ww  . ja  va 2  s  . c om*/

    final Map<String, Object> attrs = attributes.get(System.identityHashCode(entity));
    if (attrs == null || attributeName == null) {
        return null;
    }

    return attrs.get(attributeName);
}