Polishing

This commit is contained in:
Juergen Hoeller
2014-10-04 01:01:53 +02:00
parent cc02269c9f
commit 473ed1a672
6 changed files with 33 additions and 36 deletions

View File

@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -38,7 +38,6 @@ import org.springframework.messaging.support.InterceptableChannel;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
/**
* Abstract base class for a {@link MessageHandler} that broker messages to
* registered subscribers.
@@ -51,7 +50,6 @@ public abstract class AbstractBrokerMessageHandler
protected final Log logger = LogFactory.getLog(getClass());
private final SubscribableChannel clientInboundChannel;
private final MessageChannel clientOutboundChannel;
@@ -74,7 +72,7 @@ public abstract class AbstractBrokerMessageHandler
private final Object lifecycleMonitor = new Object();
private ChannelInterceptor unsentDisconnectInterceptor = new UnsentDisconnectChannelInterceptor();
private final ChannelInterceptor unsentDisconnectInterceptor = new UnsentDisconnectChannelInterceptor();
/**
@@ -151,18 +149,6 @@ public abstract class AbstractBrokerMessageHandler
return Integer.MAX_VALUE;
}
/**
* Check whether this message handler is currently running.
* <p>Note that even when this message handler is running the
* {@link #isBrokerAvailable()} flag may still independently alternate between
* being on and off depending on the concrete sub-class implementation.
*/
@Override
public final boolean isRunning() {
synchronized (this.lifecycleMonitor) {
return this.running;
}
}
@Override
public void start() {
@@ -177,9 +163,7 @@ public abstract class AbstractBrokerMessageHandler
}
startInternal();
this.running = true;
if (logger.isInfoEnabled()) {
logger.info("Started.");
}
logger.info("Started.");
}
}
@@ -199,9 +183,7 @@ public abstract class AbstractBrokerMessageHandler
((InterceptableChannel) this.clientInboundChannel).removeInterceptor(this.unsentDisconnectInterceptor);
}
this.running = false;
if (logger.isDebugEnabled()) {
logger.info("Stopped.");
}
logger.info("Stopped.");
}
}
@@ -216,6 +198,19 @@ public abstract class AbstractBrokerMessageHandler
}
}
/**
* Check whether this message handler is currently running.
* <p>Note that even when this message handler is running the
* {@link #isBrokerAvailable()} flag may still independently alternate between
* being on and off depending on the concrete sub-class implementation.
*/
@Override
public final boolean isRunning() {
synchronized (this.lifecycleMonitor) {
return this.running;
}
}
/**
* Whether the message broker is currently available and able to process messages.
* <p>Note that this is in addition to the {@link #isRunning()} flag, which
@@ -245,6 +240,7 @@ public abstract class AbstractBrokerMessageHandler
protected abstract void handleMessageInternal(Message<?> message);
protected boolean checkDestinationPrefix(String destination) {
if ((destination == null) || CollectionUtils.isEmpty(this.destinationPrefixes)) {
return true;
@@ -294,4 +290,5 @@ public abstract class AbstractBrokerMessageHandler
}
}
}
}

View File

@@ -47,8 +47,8 @@ public interface ChannelInterceptor {
/**
* Invoked after the completion of a send regardless of any exception that
* have been raised thus allowing for proper resource cleanup.
* <p>Note that this will be invoked only if preSend successfully completed
* and returned a Message, i.e. it did not return {@code null}.
* <p>Note that this will be invoked only if {@link #preSend} successfully
* completed and returned a Message, i.e. it did not return {@code null}.
* @since 4.1
*/
void afterSendCompletion(Message<?> message, MessageChannel channel, boolean sent, Exception ex);
@@ -70,7 +70,7 @@ public interface ChannelInterceptor {
/**
* Invoked after the completion of a receive regardless of any exception that
* have been raised thus allowing for proper resource cleanup.
* <p>Note that this will be invoked only if preReceive successfully
* <p>Note that this will be invoked only if {@link #preReceive} successfully
* completed and returned {@code true}.
* @since 4.1
*/

View File

@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.messaging.support;
import java.util.List;