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.arpnetworking.metrics.proxy.models.messages.LogLine.java

/**
 * {@inheritDoc}/*from w w  w  .  ja  v a 2 s. com*/
 */
@Override
public String toString() {
    return MoreObjects.toStringHelper(this).add("id", Integer.toHexString(System.identityHashCode(this)))
            .add("class", this.getClass()).add("File", _file).add("Line", _line).toString();
}

From source file:com.github.errantlinguist.latticevisualiser.StateSizeTransformer.java

/**
 * /*from w  w w. j  a v a  2 s  . co m*/
 * @return The hash code.
 */
private int calculateHashCode() {
    final int prime = 31;
    int result = 1;
    // Get the identity hash code of the graph because it may change during
    // runtime (it is mutable)
    result = prime * result + (graph == null ? 0 : System.identityHashCode(graph));
    result = prime * result + minSize;
    long temp;
    temp = Double.doubleToLongBits(stateSizeMultiplier);
    result = prime * result + (int) (temp ^ temp >>> 32);
    return result;
}

From source file:org.alfresco.traitextender.ExtenderImpl.java

public synchronized <E, M extends Trait> E getExtension(Extensible anExtensible, ExtensionPoint<E, M> point) {
    E extension = null;/*from  w ww . java2  s. c o m*/

    // consistency is checked at registration time
    @SuppressWarnings("unchecked")
    ExtensionFactory<E> factory = (ExtensionFactory<E>) pointFactories.get(point);

    if (factory != null) {
        ExtendedTrait<M> exTrait = anExtensible.getTrait(point.getTraitAPI());

        extension = exTrait.getExtension(point.getExtensionAPI());

        if (extension == null) {
            extension = exTrait.extend(point.getExtensionAPI(), factory);
            if (logger.isDebugEnabled()) {
                logger.debug("trait extension leak trace : " + System.identityHashCode(extension) + " : "
                        + System.identityHashCode(exTrait) + " : " + System.identityHashCode(extension));
            }
        }
    }
    return extension;
}

From source file:org.compass.core.transaction.LocalTransaction.java

protected void doCommit() throws CompassException {
    if (session.getSearchEngine().wasRolledBack()) {
        // don't do anything, since it was rolled back already
    }/*from  www .  ja  v  a  2  s . c  o m*/

    if (state == UNKNOWN) {
        log.debug("Not committing the transaction since within a local transaction on thread ["
                + Thread.currentThread().getName() + "] Compass [" + System.identityHashCode(compass)
                + "] Session [" + System.identityHashCode(session) + "]");
        return;
    }

    // commit called by the high level local transaction
    if (log.isDebugEnabled()) {
        log.debug("Committing local transaction on thread [" + Thread.currentThread().getName() + "] Compass ["
                + System.identityHashCode(compass) + "] Session [" + System.identityHashCode(session) + "]");
    }

    session.evictAll();
    session.getSearchEngine().commit(true);
    ((LocalTransactionFactory) transactionFactory).unbindSessionFromTransaction(this, session);
    state = COMMIT;
}

From source file:org.codehaus.groovy.grails.orm.hibernate.metaclass.AbstractSavePersistentMethod.java

public static boolean isAutoValidationDisabled(Object obj) {
    Set<Integer> identifiers = disableAutoValidationFor.get();
    return obj != null && identifiers.contains(System.identityHashCode(obj));
}

From source file:org.silverpeas.process.io.file.AbstractFileHandlerTest.java

@Before
public void beforeTest() throws Exception {
    cleanTest();/*from  www.  j  av  a2  s. co  m*/
    componentInstanceId = "component" + String.valueOf(System.identityHashCode(this)).substring(0, 2);
    currentSession = createSessionTest();
    fileHandler = new FileHandlerTest(currentSession);
    realPath = getFile(realRootPath, componentInstanceId);
    realPath.mkdirs();
    sessionPath = getFile(sessionRootPath, currentSession.getId(), BASE_PATH_TEST.getHandledNodeName(),
            componentInstanceId);
    sessionPath.mkdirs();
    touch(otherFile);
}

From source file:org.apache.geode.internal.cache.BackupJUnitTest.java

private String getName() {
    return "BackupJUnitTest_" + System.identityHashCode(this);
}

From source file:org.codehaus.groovy.grails.orm.hibernate.metaclass.AbstractSavePersistentMethod.java

public static void clearDisabledValidations(Object obj) {
    disableAutoValidationFor.get().remove(System.identityHashCode(obj));
}

From source file:org.envirocar.app.application.service.DeviceInRangeService.java

@Override
public void onCreate() {
    logger.info("onCreate " + getClass().getName() + "; Hash: " + System.identityHashCode(this));
    registerReceiver(receiver, new IntentFilter(BluetoothDevice.ACTION_FOUND));

    discoveryHandler = new Handler();

    bindToBackgroundService();/*from  w  ww  . jav  a 2  s.  co m*/
}

From source file:org.jabsorb.serializer.impl.ReferenceSerializer.java

public Object marshall(SerializerState state, Object p, Object o) throws MarshallException {
    Class clazz = o.getClass();/*from   w  w  w .ja va  2  s  .  c  om*/
    Integer identity = new Integer(System.identityHashCode(o));
    if (bridge.isReference(clazz)) {
        if (log.isDebugEnabled()) {
            log.debug("marshalling reference to object " + identity + " of class " + clazz.getName());
        }
        bridge.addReference(o);
        JSONObject jso = new JSONObject();
        try {
            jso.put("JSONRPCType", "Reference");
            jso.put("javaClass", clazz.getName());
            jso.put("objectID", identity);
        } catch (JSONException e) {
            throw new MarshallException(e.getMessage(), e);
        }
        return jso;
    } else if (bridge.isCallableReference(clazz)) {
        if (log.isDebugEnabled()) {
            log.debug("marshalling callable reference to object " + identity + " of class " + clazz.getName());
        }
        bridge.registerObject(identity, o);
        bridge.addReference(o);

        JSONObject jso = new JSONObject();
        try {
            jso.put("JSONRPCType", "CallableReference");
            jso.put("javaClass", clazz.getName());
            jso.put("objectID", identity);
        } catch (JSONException e) {
            throw new MarshallException(e.getMessage(), e);
        }

        return jso;
    }
    return null;
}