From 9664d4f2fe9da84f68644146017478f78eff9dfc Mon Sep 17 00:00:00 2001 From: Gary Russell Date: Thu, 12 Feb 2015 14:25:28 -0500 Subject: [PATCH] INT-3634/3558 Fix NPE; Remove Deprecations JIRA: https://jira.spring.io/browse/INT-3634 JIRA: https://jira.spring.io/browse/INT-3558 --- .../IntegrationMessageHeaderAccessor.java | 8 +-- .../channel/DefaultHeaderChannelRegistry.java | 65 +++---------------- 2 files changed, 10 insertions(+), 63 deletions(-) diff --git a/spring-integration-core/src/main/java/org/springframework/integration/IntegrationMessageHeaderAccessor.java b/spring-integration-core/src/main/java/org/springframework/integration/IntegrationMessageHeaderAccessor.java index 04da278728..60f6a9e770 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/IntegrationMessageHeaderAccessor.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/IntegrationMessageHeaderAccessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2014 the original author or authors. + * Copyright 2013-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,12 +46,6 @@ public class IntegrationMessageHeaderAccessor extends MessageHeaderAccessor { public static final String SEQUENCE_DETAILS = "sequenceDetails"; - /** - * @deprecated Not used; will be removed in 4.2. - */ - @Deprecated - public static final String POSTPROCESS_RESULT = "postProcessResult"; - public static final String ROUTING_SLIP = "routingSlip"; public static final String DUPLICATE_MESSAGE = "duplicateMessage"; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/channel/DefaultHeaderChannelRegistry.java b/spring-integration-core/src/main/java/org/springframework/integration/channel/DefaultHeaderChannelRegistry.java index 28567482d5..45f9778548 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/channel/DefaultHeaderChannelRegistry.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/channel/DefaultHeaderChannelRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2014 the original author or authors. + * Copyright 2013-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.atomic.AtomicLong; -import org.springframework.context.SmartLifecycle; +import org.springframework.context.Lifecycle; import org.springframework.integration.context.IntegrationObjectSupport; import org.springframework.integration.support.channel.BeanFactoryChannelResolver; import org.springframework.integration.support.channel.HeaderChannelRegistry; @@ -45,7 +45,7 @@ import org.springframework.util.Assert; * */ public class DefaultHeaderChannelRegistry extends IntegrationObjectSupport - implements HeaderChannelRegistry, SmartLifecycle, Runnable { + implements HeaderChannelRegistry, Lifecycle, Runnable { private static final int DEFAULT_REAPER_DELAY = 60000; @@ -63,10 +63,6 @@ public class DefaultHeaderChannelRegistry extends IntegrationObjectSupport private volatile boolean running; - private volatile int phase; - - private volatile boolean autoStartup = false; - private volatile boolean explicitlyStopped; /** @@ -113,42 +109,6 @@ public class DefaultHeaderChannelRegistry extends IntegrationObjectSupport super.setTaskScheduler(taskScheduler); } - /** - * @deprecated - this class will not implement {@link SmartLifecycle} in 4.2, just {@code Lifecycle}. - */ - @Deprecated - @Override - public int getPhase() { - return this.phase; - } - - /** - * @deprecated - this class will not implement {@link SmartLifecycle} in 4.2, just {@code Lifecycle}. - * @param phase - the phase to set. - */ - @Deprecated - public final void setPhase(int phase) { - this.phase = phase; - } - - /** - * @deprecated - this class will not implement {@link SmartLifecycle} in 4.2, just {@code Lifecycle}. - */ - @Deprecated - @Override - public boolean isAutoStartup() { - return this.autoStartup; - } - - /** - * @deprecated - this class will not implement {@link SmartLifecycle} in 4.2, just {@code Lifecycle}. - * @param autoStartup the boolean flag to specify {@code autoStartup} behaviour. - */ - @Deprecated - public final void setAutoStartup(boolean autoStartup) { - this.autoStartup = autoStartup; - } - @Override public final int size() { return this.channels.size(); @@ -179,7 +139,6 @@ public class DefaultHeaderChannelRegistry extends IntegrationObjectSupport this.explicitlyStopped = true; } - @Override public void stop(Runnable callback) { this.stop(); callback.run(); @@ -236,17 +195,15 @@ public class DefaultHeaderChannelRegistry extends IntegrationObjectSupport * Cancel the scheduled reap task and run immediately; then reschedule. */ @Override - public void runReaper() { - synchronized(this) { - this.reaperScheduledFuture.cancel(false); - this.reaperScheduledFuture = null; + public synchronized void runReaper() { + if (this.reaperScheduledFuture != null) { + this.reaperScheduledFuture.cancel(true); } this.run(); } @Override - public void run() { - this.reaperScheduledFuture = null; + public synchronized void run() { if (logger.isTraceEnabled()) { logger.trace("Reaper started; channels size=" + this.channels.size()); } @@ -261,12 +218,8 @@ public class DefaultHeaderChannelRegistry extends IntegrationObjectSupport iterator.remove(); } } - synchronized (this) { - if (this.reaperScheduledFuture == null) { - this.reaperScheduledFuture = this.getTaskScheduler().schedule(this, - new Date(System.currentTimeMillis() + this.reaperDelay)); - } - } + this.reaperScheduledFuture = this.getTaskScheduler().schedule(this, + new Date(System.currentTimeMillis() + this.reaperDelay)); if (logger.isTraceEnabled()) { logger.trace("Reaper completed; channels size=" + this.channels.size()); }