Example usage for org.springframework.util ObjectUtils getIdentityHexString

List of usage examples for org.springframework.util ObjectUtils getIdentityHexString

Introduction

In this page you can find the example usage for org.springframework.util ObjectUtils getIdentityHexString.

Prototype

public static String getIdentityHexString(Object obj) 

Source Link

Document

Return a hex String form of an object's identity hash code.

Usage

From source file:org.springmodules.cache.provider.ehcache.EhCacheFlushingModelTests.java

public void testToStringWithEmptyCacheNames() {
    model.setCacheNames(new String[0]);
    model.setFlushBeforeMethodExecution(true);

    String actual = model.getClass().getName() + "@" + ObjectUtils.getIdentityHexString(model)
            + "[cacheNames={}, flushBeforeMethodExecution=true]";
    assertEquals(model.toString(), actual);
}

From source file:org.springextensions.db4o.ObjectContainerFactoryBean.java

protected ObjectContainer openEmbeddedContainer(EmbeddedConfiguration embeddedConfiguration, String filename) {
    ObjectContainer container;//from w  w  w  .  j a  v  a2  s  .  c o m
    if (embeddedConfiguration == null) {
        container = Db4oEmbedded.openFile(filename);
    } else {
        logger.info("using configuration: embedded");
        container = Db4oEmbedded.openFile(embeddedConfiguration, filename);
    }
    logger.info("embedded container opened: {}", ObjectUtils.getIdentityHexString(container));
    return container;
}

From source file:com.autentia.wuija.widget.AutoCompleteInputSelection.java

public String getItemsSelectedListId() {
    return "itemsSelectedList_id" + ObjectUtils.getIdentityHexString(this);
}

From source file:org.springextensions.db4o.ObjectContainerFactoryBean.java

protected ObjectContainer openEmbeddedClientContainer(ObjectServer server) {
    ObjectContainer container = server.openClient();
    logger.info("embedded client container opened: {}", ObjectUtils.getIdentityHexString(container));
    return container;
}

From source file:org.springmodules.cache.provider.ehcache.EhCacheFlushingModelTests.java

public void testToStringWithNotEmptyCacheNames() {
    model.setCacheNames(new String[] { "main" });
    model.setFlushBeforeMethodExecution(true);

    String actual = model.getClass().getName() + "@" + ObjectUtils.getIdentityHexString(model)
            + "[cacheNames={'main'}, flushBeforeMethodExecution=true]";
    assertEquals(model.toString(), actual);
}

From source file:org.springextensions.db4o.ObjectContainerFactoryBean.java

protected ObjectContainer openRemoteClientContainer(ClientConfiguration clientConfiguration, String hostname,
        int port, String username, String password) {
    ObjectContainer container;/*w  w  w .ja  v  a2s . c  o  m*/
    if (clientConfiguration == null) {
        container = Db4oClientServer.openClient(hostname, port, username, password);
    } else {
        logger.info("using configuration: client");
        container = Db4oClientServer.openClient(clientConfiguration, hostname, port, username, password);
    }
    logger.info("remote client container opened: {}", ObjectUtils.getIdentityHexString(container));
    return container;
}

From source file:org.eclipse.gemini.blueprint.extender.internal.support.ExtenderConfiguration.java

private TaskExecutor createDefaultTaskExecutor() {
    // create thread-pool for starting contexts
    ThreadGroup threadGroup = new ThreadGroup(
            "eclipse-gemini-blueprint-extender[" + ObjectUtils.getIdentityHexString(this) + "]-threads");
    threadGroup.setDaemon(false);//w  w  w.  j a  v  a2s. c  o m

    SimpleAsyncTaskExecutor taskExecutor = new SimpleAsyncTaskExecutor();
    taskExecutor.setThreadGroup(threadGroup);
    taskExecutor.setThreadNamePrefix("EclipseGeminiBlueprintExtenderThread-");

    isTaskExecutorManagedInternally = true;

    return taskExecutor;
}

From source file:org.springframework.batch.retry.interceptor.StatefulRetryOperationsInterceptor.java

/**
 * Wrap the method invocation in a stateful retry with the policy and other
 * helpers provided. If there is a failure the exception will generally be
 * re-thrown. The only time it is not re-thrown is when retry is exhausted
 * and the recovery path is taken (though the
 * {@link MethodInvocationRecoverer} provided if there is one). In that case
 * the value returned from the method invocation will be the value returned
 * by the recoverer (so the return type for that should be the same as the
 * intercepted method).//from  w ww  . j  av a 2s .  c o m
 * 
 * @see org.aopalliance.intercept.MethodInterceptor#invoke(org.aopalliance.intercept.MethodInvocation)
 * @see MethodInvocationRecoverer#recover(Object[], Throwable)
 * 
 * @throws ExhaustedRetryException if the retry is exhausted and no
 * {@link MethodInvocationRecoverer} is provided.
 */
public Object invoke(final MethodInvocation invocation) throws Throwable {

    logger.debug("Executing proxied method in stateful retry: " + invocation.getStaticPart() + "("
            + ObjectUtils.getIdentityHexString(invocation) + ")");

    Object[] args = invocation.getArguments();
    Assert.state(args.length > 0,
            "Stateful retry applied to method that takes no arguments: " + invocation.getStaticPart());
    Object arg = args;
    if (args.length == 1) {
        arg = args[0];
    }
    final Object item = arg;

    RetryState retryState = new DefaultRetryState(keyGenerator != null ? keyGenerator.getKey(args) : item,
            newMethodArgumentsIdentifier != null ? newMethodArgumentsIdentifier.isNew(args) : false);

    Object result = retryOperations.execute(new MethodInvocationRetryCallback(invocation),
            new ItemRecovererCallback(args, recoverer), retryState);

    logger.debug("Exiting proxied method in stateful retry with result: (" + result + ")");

    return result;

}

From source file:org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.java

@Nullable
private BeanDefinitionHolder parseNestedCustomElement(Element ele, @Nullable BeanDefinition containingBd) {
    BeanDefinition innerDefinition = parseCustomElement(ele, containingBd);
    if (innerDefinition == null) {
        error("Incorrect usage of element '" + ele.getNodeName() + "' in a nested manner. "
                + "This tag cannot be used nested inside <property>.", ele);
        return null;
    }//from  ww  w  .j ava  2  s  .  c  om
    String id = ele.getNodeName() + BeanDefinitionReaderUtils.GENERATED_BEAN_NAME_SEPARATOR
            + ObjectUtils.getIdentityHexString(innerDefinition);
    if (logger.isDebugEnabled()) {
        logger.debug(
                "Using generated bean name [" + id + "] for nested custom element '" + ele.getNodeName() + "'");
    }
    return new BeanDefinitionHolder(innerDefinition, id);
}

From source file:org.springframework.boot.actuate.endpoint.jmx.EndpointMBeanExporter.java

@Override
protected ObjectName getObjectName(Object bean, String beanKey) throws MalformedObjectNameException {
    if (bean instanceof SelfNaming) {
        return ((SelfNaming) bean).getObjectName();
    }//w w w .j a v a  2  s .  c om

    if (bean instanceof EndpointMBean) {
        StringBuilder builder = new StringBuilder();
        builder.append(this.domain);
        builder.append(":type=Endpoint");
        builder.append(",name=" + beanKey);
        if (parentContextContainsSameBean(this.applicationContext, beanKey)) {
            builder.append(",context=" + ObjectUtils.getIdentityHexString(this.applicationContext));
        }
        if (this.ensureUniqueRuntimeObjectNames) {
            builder.append(
                    ",identity=" + ObjectUtils.getIdentityHexString(((EndpointMBean) bean).getEndpoint()));
        }
        builder.append(getStaticNames());
        return ObjectNameManager.getInstance(builder.toString());
    }

    return this.defaultNamingStrategy.getObjectName(bean, beanKey);
}