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.objectstyle.cayenne.event.EventSubject.java

/**
 * @return a String in the form/*from  ww w . j  a v a  2s.c  om*/
 * <code>&lt;ClassName 0x123456&gt; SomeName</code>
 * 
 * @see Object#toString()
 */
public String toString() {
    StringBuffer buf = new StringBuffer(64);

    buf.append("<");
    buf.append(this.getClass().getName());
    buf.append(" 0x");
    buf.append(Integer.toHexString(System.identityHashCode(this)));
    buf.append("> ");
    buf.append(_fullyQualifiedSubjectName);

    return buf.toString();
}

From source file:org.nuxeo.ecm.core.jca.JCAConnection.java

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

From source file:org.diffkit.diff.sns.DKDBSource.java

public String toString() {
    try {//from   w  w w  .  j a v  a 2 s .c  o m
        return String.format("%s@%x[%s,%s]", ClassUtils.getShortClassName(this.getClass()),
                System.identityHashCode(this), this.getTableName(), this.getURI().toASCIIString());
    } catch (IOException e_) {
        throw new RuntimeException(e_);
    }
}

From source file:com.sworddance.taskcontrol.TaskGroup.java

private String getTaskId(PrioritizedTask task) {
    return task.getName() != null ? task.getName()
            : task.getClass().getName() + ":" + System.identityHashCode(task);
}

From source file:org.codehaus.groovy.grails.web.taglib.GroovySyntaxTag.java

/**
 * @param in/*from w  ww .ja v  a2s.  c o m*/
 */
protected void doEachMethod(String in) {
    String var = attributes.get(ATTRIBUTE_VAR);
    String status = attributes.get(ATTRIBUTES_STATUS);
    var = extractAttributeValue(var);
    status = extractAttributeValue(status);

    boolean hasStatus = !StringUtils.isBlank(status);
    boolean hasVar = !StringUtils.isBlank(var);
    if (hasStatus && !hasVar) {
        throw new GrailsTagException(ERROR_NO_VAR_WITH_STATUS, parser.getPageName(),
                parser.getCurrentOutputLineNumber());
    }

    if (var.equals(status) && (hasStatus)) {
        throw new GrailsTagException("Attribute [" + ATTRIBUTE_VAR
                + "] cannot have the same value as attribute [" + ATTRIBUTES_STATUS + "]", parser.getPageName(),
                parser.getCurrentOutputLineNumber());
    }

    if (hasStatus) {
        out.println("loop:{");
        out.println("int " + status + " = 0");
    }
    if (!hasVar) {
        var = "_it" + Math.abs(System.identityHashCode(this));
        foreachRenamedIt = var;
    }

    String[] entryVars = null;
    if (hasVar && var.indexOf(',') > -1) {
        entryVars = var.split("\\s*,\\s*");
        var = "_entry" + Math.abs(System.identityHashCode(this));
    }

    out.print("for( " + var);
    out.print(" in "); // dot de-reference
    out.print(parser != null ? parser.getExpressionText(in, false) : extractAttributeValue(in)); // object
    out.print(" )"); // dot de-reference
    out.print(" {"); // start closure
    out.println();
    if (!hasVar) {
        out.println("changeItVariable(" + foreachRenamedIt + ")");
    } else if (entryVars != null) {
        out.println("def " + entryVars[0].trim() + "=" + var + ".getKey()");
        out.println("def " + entryVars[1].trim() + "=" + var + ".getValue()");
    }
}

From source file:jun.learn.scene.propertysource.PropertySource.java

/**
 * Produce concise output (type and name) if the current log level does not include
 * debug. If debug is enabled, produce verbose output including the hash code of the
 * PropertySource instance and every name/value property pair.
 * <p>This variable verbosity is useful as a property source such as system properties
 * or environment variables may contain an arbitrary number of property pairs,
 * potentially leading to difficult to read exception and log messages.
 * @see Log#isDebugEnabled()/*from  w w  w  .j ava2 s .  c o  m*/
 */
@Override
public String toString() {
    if (logger.isDebugEnabled()) {
        return String.format("%s@%s [name='%s', properties=%s]", getClass().getSimpleName(),
                System.identityHashCode(this), this.name, this.source);
    } else {
        return String.format("%s [name='%s']", getClass().getSimpleName(), this.name);
    }
}

From source file:org.logicblaze.lingo.cache.impl.TransactionalCacheCommand.java

protected void checkForConcurrencyFailure(Cache cache) {
    for (Iterator iter = changes.entrySet().iterator(); iter.hasNext();) {
        Map.Entry entry = (Map.Entry) iter.next();
        Object key = entry.getKey();

        VersionedValue change = (VersionedValue) entry.getValue();
        Object updateVersion = change.getVersion();
        Object version = JCacheHelper.getEntryVersion(cache, key);

        if (log.isDebugEnabled()) {
            log.debug("key: " + key + " update version: " + updateVersion + " on current version: " + version
                    + " on cache: " + System.identityHashCode(cache));
        }/*  ww w  .  j  a  va2 s.co  m*/

        if (!versionsCompatible(updateVersion, version)) {
            if (log.isDebugEnabled()) {
                log.debug(
                        "Incompatible change: version: " + version + " not compatible with: " + updateVersion);
            }
            throw new OptimisticTransactionException(cache, key, updateVersion, version);
        }
    }
    for (Iterator iter = removalVersions.entrySet().iterator(); iter.hasNext();) {
        Map.Entry entry = (Map.Entry) iter.next();
        Object key = entry.getKey();
        Object updateVersion = entry.getKey();
        Object version = JCacheHelper.getEntryVersion(cache, key);

        if (log.isDebugEnabled()) {
            log.debug("key: " + key + " remove version: " + updateVersion + " on current version: " + version
                    + " on cache: " + System.identityHashCode(cache));
        }

        if (!versionsCompatible(updateVersion, version)) {
            if (log.isDebugEnabled()) {
                log.debug(
                        "Incompatible remove: version: " + version + " not compatible with: " + updateVersion);
            }
            throw new OptimisticTransactionException(cache, key, updateVersion, version);
        }
    }
    if (readVersions != null) {
        for (Iterator iter = readVersions.entrySet().iterator(); iter.hasNext();) {
            Map.Entry entry = (Map.Entry) iter.next();
            Object key = entry.getKey();
            Object updateVersion = entry.getKey();
            Object version = JCacheHelper.getEntryVersion(cache, key);

            if (log.isDebugEnabled()) {
                log.debug("key: " + key + " read version: " + updateVersion + " on current version: " + version
                        + " on cache: " + System.identityHashCode(cache));
            }

            if (!versionsCompatible(updateVersion, version)) {
                if (log.isDebugEnabled()) {
                    log.debug("Incompatible read: version: " + version + " not compatible with: "
                            + updateVersion);
                }
                throw new OptimisticTransactionException(cache, key, updateVersion, version);
            }
        }
    }
}

From source file:nz.co.senanque.vaadinsupport.application.MaduraSessionManager.java

public void register(Label field) {
    int key = System.identityHashCode(field);
    if (m_labels.get(key) == null) {
        m_labels.put(key, field);/*from  w w  w  . j a  v a 2 s . c om*/
    }
}

From source file:chronos.mbeans.QuartzSchedulerAdapter.java

/**
 * {@inheritDoc}/*from   w  w w . ja va2s .  co m*/
 *
 * @see chronos.mbeans.QuartzSchedulerAdapterMBean#shutdown()
 */
@Override
public final void shutdown() {
    final Scheduler scheduler = schedulerRef.get();
    if (scheduler != null) {
        try {
            logger.trace("Got scheduler "
                    + getUniqueIdentifier(scheduler.getSchedulerName(), scheduler.getSchedulerInstanceId())
                    + "@" + System.identityHashCode(scheduler));
            TestJob.unschedule(scheduler);
            final String[] jobGroupNames = scheduler.getJobGroupNames();
            if (schedulerInstanceName.equals(scheduler.getSchedulerName())) {
                if (jobGroupNames.length == 0) {
                    logger.debug("Quartz scheduler shutting down...");
                    try {
                        scheduler.shutdown(true);
                    } catch (final SchedulerException e) {
                        logger.error("Encountered exception shutting down Quartz: " + e.getMessage(), e);
                    }
                } else {
                    logger.debug("Job groups still running "
                            + StringUtils.arrayToCommaDelimitedString(jobGroupNames));
                }
            } else {
                logger.trace("Was using an existing scheduler instance, so won't perform actual shutdown.");
            }
        } catch (final SchedulerException e) {
            logger.error(e.getMessage(), e);
        }
        if (!schedulerRef.compareAndSet(scheduler, null)) {
            logger.warn("Tried to set schedulerRef to null but was set to a different value!");
        }
    } else {
        logger.error("schedulerRef.get() returned null!");
    }
}

From source file:com.jaspersoft.jasperserver.api.engine.jasperreports.util.RepositoryCacheMap.java

private String getLockName() {
    return "RepositoryCacheMap_" + System.identityHashCode(this);
}