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:org.kotemaru.android.sample.webview.XMLHttpRequestXS.java

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

From source file:org.apache.hadoop.hbase.client.AsyncTableResultScanner.java

private void resumePrefetch() {
    if (LOG.isDebugEnabled()) {
        LOG.debug(String.format("0x%x", System.identityHashCode(this)) + " resume prefetching");
    }/*www . ja va 2  s. c om*/
    resumer.resume();
    resumer = null;
}

From source file:org.nuxeo.ecm.platform.login.NuxeoAbstractServerLoginModule.java

public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState,
        Map<String, ?> options) {
    this.subject = subject;
    this.callbackHandler = callbackHandler;
    this.sharedState = sharedState;
    this.options = options;
    if (log.isTraceEnabled()) {
        log.trace("initialize, instance=@" + System.identityHashCode(this));
    }/*  w  w w  .  j  av a2  s  .c  o  m*/

    /*
     * Check for password sharing options. Any non-null value for password_stacking sets useFirstPass as this module
     * has no way to validate any shared password.
     */
    String passwordStacking = (String) options.get("password-stacking");
    if (passwordStacking != null && passwordStacking.equalsIgnoreCase("useFirstPass")) {
        useFirstPass = true;
    }

    // Check for a custom Principal implementation
    principalClassName = (String) options.get("principalClass");

    // Check for unauthenticatedIdentity option.
    String name = (String) options.get("unauthenticatedIdentity");
    if (name != null) {
        try {
            unauthenticatedIdentity = createIdentity(name);
            log.trace("Saw unauthenticatedIdentity=" + name);
        } catch (LoginException e) {
            log.warn("Failed to create custom unauthenticatedIdentity", e);
        }
    }
}

From source file:com.tesora.dve.common.catalog.CatalogDAO.java

@Override
public String toString() {
    return "CatalogDAO@" + System.identityHashCode(this);
}

From source file:com.weihuoya.bboo._G.java

public static void logObjectId(Object o) {
    if (o != null) {
        log(o.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(o)));
    } else {/*from w  w w . j  a  v a 2 s.c  o  m*/
        log("object@null");
    }
}

From source file:com.arpnetworking.clusteraggregator.configuration.ClusterAggregatorConfiguration.java

/**
 * {@inheritDoc}/*ww w. j ava  2 s .  c o m*/
 */
@Override
public String toString() {
    return MoreObjects.toStringHelper(this).add("id", Integer.toHexString(System.identityHashCode(this)))
            .add("MonitoringCluster", _monitoringCluster).add("HttpHost", _httpHost).add("HttpPort", _httpPort)
            .add("HttpHealthCheckPath", _httpHealthCheckPath).add("HttpStatusPath", _httpStatusPath)
            .add("AggregatorHost", _aggregationHost).add("AggregatorPort", _aggregationPort)
            .add("LogDirectory", _logDirectory).add("AkkaConfiguration", _akkaConfiguration)
            .add("HostPipelineConfiguration", _hostPipelineConfiguration)
            .add("ClusterPipelineConfiguration", _hostPipelineConfiguration)
            .add("MinConnectionTimeout", _minConnectionTimeout)
            .add("MaxConnectionTimeout", _maxConnectionTimeout)
            .add("JvmMetricsCollectionInterval", _jvmMetricsCollectionInterval)
            .add("RebalanceConfiguration", _rebalanceConfiguration).add("ClusterHostSuffix", _clusterHostSuffix)
            .add("DatabaseConfigurations", _databaseConfigurations).toString();
}

From source file:IdentityIntMap.java

/**
 * Puts a new value in the property table with the appropriate flags
 *//*from w w w.  j  ava 2  s .c o m*/
public int get(Object key) {
    int mask = _mask;
    int hash = System.identityHashCode(key) % mask & mask;

    Object[] keys = _keys;

    while (true) {
        Object mapKey = keys[hash];

        if (mapKey == null)
            return NULL;
        else if (mapKey == key)
            return _values[hash];

        hash = (hash + 1) % mask;
    }
}

From source file:org.apache.jmeter.protocol.jdbc.config.DataSourceElement.java

@Override
public void testEnded() {
    synchronized (this) {
        if (dbcpDataSource != null) {
            try {
                dbcpDataSource.close();/*from  w  w  w  .  jav a  2  s  .c  o m*/
            } catch (SQLException ex) {
                log.error("Error closing pool:" + getName(), ex);
            }
        }
        dbcpDataSource = null;
    }
    if (perThreadPoolSet != null) {// in case
        for (BasicDataSource dsc : perThreadPoolSet) {
            log.debug("Closing pool: " + getDataSourceName() + " @" + System.identityHashCode(dsc));
            try {
                dsc.close();
            } catch (SQLException ex) {
                log.error("Error closing pool:" + getName(), ex);
            }
        }
        perThreadPoolSet = null;
    }
}

From source file:IdentityMap.java

/**
 * {@inheritDoc}//from   w  w  w.  j av a2 s. co  m
 * @see java.util.Map#put(java.lang.Object, java.lang.Object)
 */
public Object put(final Object key, final Object value) {
    int hash = System.identityHashCode(key);
    int index = hash % _capacity;
    if (index < 0) {
        index = -index;
    }

    Entry entry = _buckets[index];
    Entry prev = null;
    while (entry != null) {
        if (entry.getKey() == key) {
            // There is a mapping for this key so we have to replace the value.
            Object ret = entry.getValue();
            entry.setValue(value);
            return ret;
        }
        prev = entry;
        entry = entry.getNext();
    }
    if (prev == null) {
        // There is no previous entry in this bucket.
        _buckets[index] = new Entry(key, hash, value);
    } else {
        // Next entry is empty so we have no mapping for this key.
        prev.setNext(new Entry(key, hash, value));
    }
    _entries++;
    if (_entries > _maximum) {
        rehash();
    }
    return null;
}

From source file:com.woodblockwithoutco.beretainedexample.MainActivity.java

protected CharSequence[] getItems() {
    //filling list with entries like "fieldName 0xfieldHash"
    String[] fieldNames = new String[] { "mIntArray", "mObject", "mMap", };

    String[] fieldHashcodes = new String[] { "0x" + Integer.toHexString(System.identityHashCode(mIntArray)),
            "0x" + Integer.toHexString(System.identityHashCode(mObject)),
            "0x" + Integer.toHexString(System.identityHashCode(mMap)) };

    if (fieldHashcodes.length != fieldNames.length) {
        throw new IllegalStateException("Did you forget to add something?");
    }/*from  w w w . j a v  a2 s  . c  om*/

    int length = fieldHashcodes.length;
    CharSequence[] items = new CharSequence[length];
    for (int i = 0; i < length; i++) {
        SpannableStringBuilder description = new SpannableStringBuilder();
        description.append(fieldNames[i]);
        description.setSpan(new TypefaceSpan("bold"), 0, description.length(),
                Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        description.append(" ").append(fieldHashcodes[i]);
        items[i] = description;
    }

    return items;
}