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:cn.remex.core.util.ObjectUtils.java

/**
 * Return a hex String form of an object's identity hash code.
 * @param obj the object//from w w w . ja  va2s .c  o  m
 * @return the object's identity code in hex notation
 */
public static String getIdentityHexString(final Object obj) {
    return Integer.toHexString(System.identityHashCode(obj));
}

From source file:org.nuxeo.ecm.core.repository.jcr.XASessionWrapper.java

@Override
public String toString() {
    String ecmSessionString = ecmSession == null ? "N/A" : String.valueOf(ecmSession.getSessionId());
    return Integer.toHexString(System.identityHashCode(this)) + "; ecm session id: " + ecmSessionString;
}

From source file:de.kaiserpfalzEdv.commons.dto.NameBuilder.java

public Comparator<Nameable> getDisplayNameComparator() {
    return new Comparator<Nameable>() {
        @Override/*ww w.j av a2  s  . c  om*/
        public int compare(Nameable o1, Nameable o2) {
            return new CompareToBuilder().append(o1.getDisplayName(), o2.getDisplayName()).build();
        }

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

From source file:org.eclipse.gemini.blueprint.extender.internal.blueprint.activator.BlueprintListenerManager.java

public void blueprintEvent(BlueprintEvent event) {
    replayManager.addEvent(event);/*  w  ww.j a  v  a2 s. c  o m*/

    for (BlueprintListener listener : listeners) {
        try {
            listener.blueprintEvent(event);
        } catch (Exception ex) {
            log.warn("exception encountered when calling listener " + System.identityHashCode(listener), ex);
        }
    }
}

From source file:UuidUtil.java

/**
 * Method getIdentityHashCode/*w  w  w  . j  a  v a 2  s  .  co m*/
 * 
 * 
 * @return
 * 
 * @audience
 */
private static String getIdentityHashCode(Object obj) {

    String result = null;
    try {
        int hc = System.identityHashCode(obj);
        return formatHexString(hc);

    } catch (Exception ex) {
        // must return a value
        // return null;
        return "8AF5182";
    }
}

From source file:org.diffkit.diff.custom.DKAbstractCustomDBSink.java

public String toString() {
    return String.format("%s@%x", ClassUtils.getShortClassName(this.getClass()), System.identityHashCode(this));
}

From source file:org.apache.mnemonic.collections.DurableHashSetNGTest.java

@BeforeClass
public void setUp() throws Exception {
    rand = Utils.createRandom();/*from w  w  w .  j av  a  2  s. co  m*/
    unsafe = Utils.getUnsafe();
    m_act = new NonVolatileMemAllocator(Utils.getNonVolatileMemoryAllocatorService("pmalloc"),
            1024 * 1024 * 1024, "./pobj_hashset.dat", true);
    cKEYCAPACITY = m_act.handlerCapacity();
    m_act.setBufferReclaimer(new Reclaim<ByteBuffer>() {
        @Override
        public boolean reclaim(ByteBuffer mres, Long sz) {
            System.out.println(String.format("Reclaim Memory Buffer: %X  Size: %s",
                    System.identityHashCode(mres), null == sz ? "NULL" : sz.toString()));
            System.out.println(" String buffer " + mres.asCharBuffer().toString());
            return false;
        }
    });
    m_act.setChunkReclaimer(new Reclaim<Long>() {
        @Override
        public boolean reclaim(Long mres, Long sz) {
            System.out.println(String.format("Reclaim Memory Chunk: %X  Size: %s",
                    System.identityHashCode(mres), null == sz ? "NULL" : sz.toString()));
            return false;
        }
    });

    for (long i = 0; i < cKEYCAPACITY; ++i) {
        m_act.setHandler(i, 0L);
    }
}

From source file:com.vaadin.spring.internal.BeanStore.java

@Override
public String toString() {
    return String.format("%s[id=%x, name=%s]", getClass().getSimpleName(), System.identityHashCode(this), name);
}

From source file:IK.AbstractBone.java

/**
 * // ww w . j  a  v  a2 s .c  om
 * @param par the parent bone for this bone
 * @param tipHeading the orienational heading of this bone (global vs relative coords specified in coordinateType)
 * @param rollHeading axial rotation heading of the bone (it's z-axis) 
 * @param inputTag some user specified name for the bone, if desired 
 * @param inputBoneHeight bone length 
 * @param coordinateType
 * @throws NullParentForBoneException
 */

public AbstractBone(AbstractBone par, //parent bone
        DVector tipHeading, //the orienational heading of this bone (global vs relative coords specified in coordinateType)
        DVector rollHeading, //axial rotation heading of the bone (it's z-axis) 
        String inputTag, //some user specified name for the bone, if desired 
        double inputBoneHeight, //bone length 
        frameType coordinateType) throws NullParentForBoneException {
    if (par != null) {
        if (this.tag == null || this.tag == "") {
            this.tag = Integer.toString(System.identityHashCode(this));
        } else
            this.tag = inputTag;
        this.boneHeight = inputBoneHeight;

        Ray tipHeadingRay = new Ray(par.getTip(), tipHeading);
        Ray rollHeadingRay = new Ray(par.getTip(), rollHeading);
        DVector tempTip = new DVector();
        DVector tempRoll = new DVector();
        DVector tempX = new DVector();

        if (coordinateType == frameType.GLOBAL) {
            tempTip = tipHeadingRay.heading();
            tempRoll = rollHeadingRay.heading();
        } else if (coordinateType == frameType.RELATIVE) {
            tempTip = par.localAxes().getGlobalOf(tipHeadingRay.heading());
            tempRoll = par.localAxes().getGlobalOf(rollHeadingRay.heading());
        } else {

            System.out.println("WOAH WOAH WOAH");
        }

        tempX = tempRoll.cross(tempTip);
        tempRoll = tempX.cross(tempTip);

        this.parent = par;
        this.parentArmature = this.parent.parentArmature;
        parentArmature.addToBoneList(this);

        generateAxes(parent.getTip(), tempX, tempTip, tempRoll);
        this.localAxes.orthogonalize();
        localAxes.setParent(parent.localAxes);

        previousOrientation = localAxes.attachedCopy(true);

        majorRotationAxes = parent.localAxes().getAbsoluteCopy();
        majorRotationAxes.translateTo(parent.getTip());
        majorRotationAxes.setParent(parent.localAxes);

        this.parent.addFreeChild(this);
        this.parent.addChild(this);

        this.updateSegmentedArmature();
    } else {
        throw new NullParentForBoneException();
    }

}

From source file:org.jabsorb.client.Client.java

/**
 * This method is public because of the inheritance from the
 * InvokationHandler -- should never be called directly.
 *///from  w  w w  .  ja  v  a  2  s.  com
public Object invoke(Object proxyObj, Method method, Object[] args) throws Exception {
    String methodName = method.getName();
    if (methodName.equals("hashCode")) {
        return new Integer(System.identityHashCode(proxyObj));
    } else if (methodName.equals("equals")) {
        return (proxyObj == args[0] ? Boolean.TRUE : Boolean.FALSE);
    } else if (methodName.equals("toString")) {
        return proxyObj.getClass().getName() + '@' + Integer.toHexString(proxyObj.hashCode());
    }
    return invoke(proxyMap.getString(proxyObj), method.getName(), args, method.getReturnType());
}