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.microsoft.tfs.core.clients.workitem.internal.query.StoredQueryBucket.java

@Override
public String toString() {
    return MessageFormat.format("p={0} q={1} r={2} h={3}", //$NON-NLS-1$
            Integer.toString(projectId), queries.size(), Long.toString(rowVersion),
            Integer.toHexString(System.identityHashCode(this)));
}

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

private void stopPrefetch(ScanController controller) {
    if (LOG.isDebugEnabled()) {
        LOG.debug(String.format("0x%x", System.identityHashCode(this)) + " stop prefetching when scanning "
                + rawTable.getName() + " as the cache size " + cacheSize + " is greater than the maxCacheSize "
                + maxCacheSize);//from w ww  .  ja  v a  2  s . c  om
    }
    resumer = controller.suspend();
}

From source file:org.diorite.impl.scheduler.DioriteTaskImpl.java

DioriteTaskImpl(final Runnable task) {
    this(task.getClass().getName() + "@" + System.identityHashCode(task), null, task, null, false, -1,
            STATE_SINGLE);
}

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

/**
 * //from  w  w w .j  a  v a  2 s .  c  o 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 + (nonwords == null ? 0 : nonwords.hashCode());
    return result;
}

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

@BeforeClass
public void setUp() {
    m_rand = Utils.createRandom();/*from   w  w  w . j  ava  2  s .com*/
    m_act = new NonVolatileMemAllocator(Utils.getNonVolatileMemoryAllocatorService("pmalloc"),
            1024 * 1024 * 1024, "./pobj_NodeValue_WithParamHolder.dat", true);
    ph = new ParameterHolder();

    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()));
            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:org.mariotaku.twidere.util.ActivityTracker.java

@Override
public void onActivityStopped(Activity activity) {
    final int hashCode = System.identityHashCode(activity);
    if (activity instanceof HomeActivity) {
        mHomeActivityStarted = false;/*from w w w .  j  a  va 2  s.  com*/
    }
    // BEGIN HotMobi
    final SessionEvent event = mSessionEvent;
    if (event != null && !isSwitchingInSameTask(hashCode)) {
        event.markEnd();
        HotMobiLogger.getInstance(activity).log(event, new PreProcessing<SessionEvent>() {
            @Override
            public void process(SessionEvent event, Context appContext) {
                event.dumpPreferences(appContext);
            }
        });
        mSessionEvent = null;
    }
    // END HotMobi

    mInternalStack.removeElement(hashCode);
}

From source file:thymeleafsandbox.springjsp.business.entities.User.java

@Override
public String toString() {
    return "User{" + "@=" + System.identityHashCode(this) + ", id=" + this.id + ", name='" + this.name + '\''
            + ", surname='" + this.surname + '\'' + ", multiValues=" + this.multiValues + ", active="
            + this.active + ", registrationDate=" + this.registrationDate + '}';
}

From source file:org.archive.modules.extractor.ExtractorPDF.java

protected boolean innerExtract(CrawlURI curi) {
    File tempFile;//from   ww w .  j a v a 2s  .co m

    int sn;
    Thread thread = Thread.currentThread();
    if (thread instanceof SinkHandlerLogThread) {
        sn = ((SinkHandlerLogThread) thread).getSerialNumber();
    } else {
        sn = System.identityHashCode(thread);
    }
    try {
        tempFile = File.createTempFile("tt" + sn, "tmp.pdf");
    } catch (IOException ioe) {
        throw new RuntimeException(ioe);
    }

    PDFParser parser;
    ArrayList<String> uris;
    try {
        curi.getRecorder().copyContentBodyTo(tempFile);
        parser = new PDFParser(tempFile.getAbsolutePath());
        uris = parser.extractURIs();
    } catch (IOException e) {
        curi.getNonFatalFailures().add(e);
        return false;
    } catch (RuntimeException e) {
        // Truncated/corrupt  PDFs may generate ClassCast exceptions, or
        // other problems
        curi.getNonFatalFailures().add(e);
        return false;
    } finally {
        FileUtils.deleteSoonerOrLater(tempFile);
    }

    if (uris == null) {
        return true;
    }

    for (String uri : uris) {
        try {
            UURI src = curi.getUURI();
            UURI dest = UURIFactory.getInstance(uri);
            LinkContext lc = LinkContext.NAVLINK_MISC;
            Hop hop = Hop.NAVLINK;
            addOutlink(curi, dest, lc, hop);
        } catch (URIException e1) {
            // There may not be a controller (e.g. If we're being run
            // by the extractor tool).
            logUriError(e1, curi.getUURI(), uri);
        }
    }

    numberOfLinksExtracted.addAndGet(uris.size());

    LOGGER.fine(curi + " has " + uris.size() + " links.");
    // Set flag to indicate that link extraction is completed.
    return true;
}

From source file:org.eclipse.gemini.blueprint.compendium.internal.cm.DefaultManagedServiceBeanManager.java

void applyInitialInjection(Object instance, Map configuration) {
    if (log.isTraceEnabled())
        log.trace("Applying injection to instance " + instance.getClass() + "@"
                + System.identityHashCode(instance) + " using map " + configuration);
    CMUtils.applyMapOntoInstance(instance, configuration, bf);
}

From source file:org.kuali.coeus.sys.framework.controller.interceptor.KcUifHandlerExceptionResolver.java

@Override
public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler,
        Exception ex) {//from   w  w  w.jav a2  s  .  c  o  m
    UserSession requestSession = (UserSession) request.getSession()
            .getAttribute(KRADConstants.USER_SESSION_KEY);
    if (System.identityHashCode(GlobalVariables.getUserSession()) != System.identityHashCode(requestSession)) {
        LOG.error("User Session Difference Detected. GlobalVariables session = "
                + GlobalVariables.getUserSession() + ", request session = " + requestSession);
    }
    GlobalVariables.setUserSession(requestSession);

    //Avoids NPE in rice incident handler
    if (handler == null) {
        return innerHandler.resolveException(request, response, NullHandler.INSTANCE, ex);
    }

    return innerHandler.resolveException(request, response, handler, ex);
}