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.redhat.example.rules.unittest.CsvTestHelper.java

private static void checkAttributes(Object actual, int actualIndex, ExpectedRecord expect, Class<?> clazz,
        Class<?> keyClass, Map<String, Boolean> testSkipMap) {
    Object expectedFact = expect.fact;
    boolean isMap = keyClass != null;
    for (Map.Entry<String, Object> entry : expect.map.entrySet()) {
        // filter out attributes both of PARENT_ROW and Test Skip keys.
        if (entry.getKey().indexOf("#") == -1 && !testSkipMap.get(entry.getKey())) {
            String key = entry.getKey();
            Object value = entry.getValue();
            // check if the equality between the expected value and the fact's attribute value
            Object actualObj = (!isMap) ? actual : ((MapEntry) actual).value;
            Object expectObj = (!isMap) ? expectedFact : ((MapEntry) expectedFact).value;
            if (RuleFactWatcher.Constants.nullCheckStr.equals(value)) {
                // check if it is null as the expected value is "should be null" value
                logger.debug("**assertExpectCSV** Checking actual {} {}[{}]@{}",
                        (isMap) ? ("key:'" + ((MapEntry) actual).key + "' value") : "record",
                        clazz.getSimpleName(), actualIndex - 1, System.identityHashCode(actual));
                if (!isMap) {
                    assertThat(actual, hasProperty(key, is(nullValue())));
                } else {
                    assertThat(actualObj, is(nullValue()));
                }/*from   ww w  .  j  av  a 2s .c  o  m*/
            } else if (!StringUtils.isEmpty((String) value)) {
                logger.debug("**assertExpectCSV** Checking actual {} {}[{}]@{}",
                        (isMap) ? ("key:'" + ((MapEntry) actual).key + "' value") : "record",
                        clazz.getSimpleName(), actualIndex - 1, System.identityHashCode(actualObj));
                if (key.contains(".") || key.contains("[")) {
                    // get the target attribute value
                    Object actualField = RuleFactWatcher.getProperty(actualObj, key);
                    Object expectField = RuleFactWatcher.getProperty(expectObj, key);
                    assertThat(actualField, is(expectField));
                } else if (key.equals(RuleFactWatcher.Constants.valueAttributeStr)
                        && RuleFactWatcher.isImmutable(actualObj.getClass())) {
                    assertThat(actualObj, is(expectObj));
                } else {
                    // get the target attribute value
                    Object expectField = RuleFactWatcher.getProperty(expectObj, key);
                    assertThat(actualObj, hasProperty(key, is(expectField)));
                }
            }
        }
    }
}

From source file:com.clark.func.Functions.java

public static int identityHashCode(Object obj) {
    return System.identityHashCode(obj);
}

From source file:org.apache.camel.util.ObjectHelper.java

public static String getIdentityHashCode(Object object) {
    return "0x" + Integer.toHexString(System.identityHashCode(object));
}

From source file:org.apache.hadoop.ha.ActiveStandbyElector.java

@Override
public String toString() {
    return "elector id=" + System.identityHashCode(this) + " appData="
            + ((appData == null) ? "null" : StringUtils.byteToHexString(appData)) + " cb=" + appClient;
}

From source file:org.mule.module.mongo.MongoCloudConnector.java

@ConnectionIdentifier
public String connectionId() {
    return mongo == null ? "n/a" : Mongo.class.getName() + System.identityHashCode(mongo);
}

From source file:org.nuxeo.ecm.core.storage.sql.jdbc.JDBCMapper.java

protected static String systemToString(Object o) {
    return o.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(o));
}

From source file:com.simiacryptus.mindseye.lang.Tensor.java

@Nonnull
@Override/*w  ww.j  a v  a2s . c  om*/
public String toString() {
    return (null == data ? "0" : Integer.toHexString(System.identityHashCode(data))) + "@" + toString(false);
}

From source file:kilim.analysis.BasicBlock.java

@Override
public String toString() {
    StringBuffer sb = new StringBuffer(200);
    sb.append("\n========== BB #").append(id).append("[").append(System.identityHashCode(this)).append("]\n");
    sb.append("method: ").append(this.flow.name).append(this.flow.desc).append("\n");
    sb.append("start = ").append(startPos).append(",end = ").append(endPos).append('\n').append("Successors:");
    if (successors.isEmpty())
        sb.append(" None");
    else {/*  w w w  .  j  ava2s  .c  o  m*/
        for (int i = 0; i < successors.size(); i++) {
            BasicBlock succ = successors.get(i);
            sb.append(" ").append(succ.id).append("[").append(System.identityHashCode(succ)).append("]");
        }
    }
    sb.append("\nHandlers:");
    if (handlers.isEmpty())
        sb.append(" None");
    else {
        for (int i = 0; i < handlers.size(); i++) {
            sb.append(" ").append(handlers.get(i).catchBB.id);
        }
    }
    sb.append("\nStart frame:\n").append(startFrame);
    sb.append("\nUsage: ").append(usage);
    return sb.toString();
}

From source file:com.twitter.pig.backend.hadoop.executionengine.tez.TezJobControlCompiler.java

public static String addSingleFileToDistributedCache(PigContext pigContext, Configuration conf, String filename,
        String prefix) throws IOException {

    if (!pigContext.inIllustrator && !FileLocalizer.fileExists(filename, pigContext)) {
        throw new IOException("Internal error: skew join partition file " + filename + " does not exist");
    }/*  w  w  w.  ja  va  2s.co m*/

    String symlink = filename;

    // XXX Hadoop currently doesn't support distributed cache in local mode.
    // This line will be removed after the support is added by Hadoop team.
    if (pigContext.getExecType() != ExecType.TEZ_LOCAL) {
        symlink = prefix + "_" + Integer.toString(System.identityHashCode(filename)) + "_"
                + Long.toString(System.currentTimeMillis());
        filename = filename + "#" + symlink;
        setupDistributedCache(pigContext, conf, new String[] { filename }, false);
    }

    return symlink;
}

From source file:com.greenlaw110.rythm.toString.ToStringStyle.java

/**
 * <p>Append the {@link System#identityHashCode(Object)}.</p>
 *
 * @param buffer  the <code>StringBuilder</code> to populate
 * @param object  the <code>Object</code> whose id to output
 *//*from w w w . j  av  a 2  s .c om*/
protected void appendIdentityHashCode(StringBuilder buffer, Object object) {
    if (this.isUseIdentityHashCode() && object != null) {
        register(object);
        buffer.append('@');
        buffer.append(Integer.toHexString(System.identityHashCode(object)));
    }
}