Spring Integration

org.springframework.integration.channel
Class AbstractPollableChannel

java.lang.Object
  extended by org.springframework.integration.context.IntegrationObjectSupport
      extended by org.springframework.integration.channel.AbstractMessageChannel
          extended by org.springframework.integration.channel.AbstractPollableChannel
All Implemented Interfaces:
BeanFactoryAware, BeanNameAware, InitializingBean, MessageChannel, PollableChannel, NamedComponent
Direct Known Subclasses:
QueueChannel

public abstract class AbstractPollableChannel
extends AbstractMessageChannel
implements PollableChannel

Base class for all pollable channels.

Author:
Mark Fisher

Nested Class Summary
 
Nested classes/interfaces inherited from class org.springframework.integration.channel.AbstractMessageChannel
AbstractMessageChannel.ChannelInterceptorList
 
Constructor Summary
AbstractPollableChannel()
           
 
Method Summary
protected abstract  Message<?> doReceive(long timeout)
          Subclasses must implement this method.
 Message<?> receive()
          Receive the first available message from this channel.
 Message<?> receive(long timeout)
          Receive the first available message from this channel.
 
Methods inherited from class org.springframework.integration.channel.AbstractMessageChannel
addInterceptor, doSend, getComponentType, getInterceptors, getSendErrorCount, getSendSuccessCount, send, send, setConversionService, setDatatypes, setInterceptors
 
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, getBeanFactory, getChannelResolver, getComponentName, getConversionService, getTaskScheduler, onInit, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setTaskScheduler, toString, writeMessageHistory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.springframework.integration.core.MessageChannel
send, send
 

Constructor Detail

AbstractPollableChannel

public AbstractPollableChannel()
Method Detail

receive

public final Message<?> receive()
Receive the first available message from this channel. If the channel contains no messages, this method will block.

Specified by:
receive in interface PollableChannel
Returns:
the first available message or null if the receiving thread is interrupted.

receive

public final Message<?> receive(long timeout)
Receive the first available message from this channel. If the channel contains no messages, this method will block until the allotted timeout elapses. If the specified timeout is 0, the method will return immediately. If less than zero, it will block indefinitely (see receive()).

Specified by:
receive in interface PollableChannel
Parameters:
timeout - the timeout in milliseconds
Returns:
the first available message or null if no message is available within the allotted time or the receiving thread is interrupted.

doReceive

protected abstract Message<?> doReceive(long timeout)
Subclasses must implement this method. A non-negative timeout indicates how long to wait if the channel is empty (if the value is 0, it must return immediately with or without success). A negative timeout value indicates that the method should block until either a message is available or the blocking thread is interrupted.


Spring Integration

Copyright © 2010. All Rights Reserved.