Example usage for org.springframework.integration.aggregator MethodInvokingReleaseStrategy MethodInvokingReleaseStrategy

List of usage examples for org.springframework.integration.aggregator MethodInvokingReleaseStrategy MethodInvokingReleaseStrategy

Introduction

In this page you can find the example usage for org.springframework.integration.aggregator MethodInvokingReleaseStrategy MethodInvokingReleaseStrategy.

Prototype

public MethodInvokingReleaseStrategy(Object object, String methodName) 

Source Link

Usage

From source file:org.springframework.integration.config.ReleaseStrategyFactoryBean.java

@Override
public void afterPropertiesSet() throws Exception {
    if (this.target instanceof ReleaseStrategy && !StringUtils.hasText(this.methodName)) {
        this.strategy = (ReleaseStrategy) this.target;
        return;//from  w w w .ja va2  s  .  co  m
    }
    if (this.target != null) {
        if (StringUtils.hasText(this.methodName)) {
            this.strategy = new MethodInvokingReleaseStrategy(this.target, this.methodName);
        } else {
            Method method = MessagingAnnotationUtils.findAnnotatedMethod(this.target,
                    org.springframework.integration.annotation.ReleaseStrategy.class);
            if (method != null) {
                this.strategy = new MethodInvokingReleaseStrategy(this.target, method);
            } else {
                if (logger.isWarnEnabled()) {
                    logger.warn("No ReleaseStrategy annotated method found on "
                            + this.target.getClass().getSimpleName()
                            + "; falling back to SequenceSizeReleaseStrategy, target:" + this.target
                            + ", methodName:" + this.methodName);
                }
            }
        }
    } else {
        if (logger.isWarnEnabled()) {
            logger.warn("No target supplied; falling back to SequenceSizeReleaseStrategy");
        }
    }
}