org.springframework.integration.channel
Class NullChannel

java.lang.Object
  extended by org.springframework.integration.channel.NullChannel
All Implemented Interfaces:
MessageChannel, BlockingTarget, MessageSource, MessageTarget

public class NullChannel
extends java.lang.Object
implements MessageChannel

A channel implementation that essentially behaves like "/dev/null". All receive() calls will return null, and all send() calls will return true although no action is performed. Note however that the invocations are logged at debug-level.

Author:
Mark Fisher

Field Summary
private  org.apache.commons.logging.Log logger
           
 
Constructor Summary
NullChannel()
           
 
Method Summary
 java.util.List<Message<?>> clear()
           
 java.lang.String getName()
          Always returns null.
 java.util.List<Message<?>> purge(MessageSelector selector)
           
 Message receive()
           
 Message receive(long timeout)
           
 boolean send(Message<?> message)
          Send a message, blocking indefinitely if necessary.
 boolean send(Message<?> message, long timeout)
          Send a message, blocking until either the message is accepted or the specified timeout period elapses.
 void setName(java.lang.String name)
          The channel name cannot be set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private org.apache.commons.logging.Log logger
Constructor Detail

NullChannel

public NullChannel()
Method Detail

clear

public java.util.List<Message<?>> clear()

getName

public java.lang.String getName()
Always returns null.

Specified by:
getName in interface MessageChannel

purge

public java.util.List<Message<?>> purge(MessageSelector selector)

setName

public void setName(java.lang.String name)
The channel name cannot be set. It is always null.


receive

public Message receive()

receive

public Message receive(long timeout)

send

public boolean send(Message<?> message)
Description copied from interface: BlockingTarget
Send a message, blocking indefinitely if necessary.

Specified by:
send in interface BlockingTarget
Specified by:
send in interface MessageTarget
Parameters:
message - the Message to send
Returns:
true if the message is sent successfully, false if interrupted

send

public boolean send(Message<?> message,
                    long timeout)
Description copied from interface: BlockingTarget
Send a message, blocking until either the message is accepted or the specified timeout period elapses.

Specified by:
send in interface BlockingTarget
Parameters:
message - the Message to send
timeout - the timeout in milliseconds
Returns:
true if the message is sent successfully, false if the specified timeout period elapses or the send is interrupted