Removed BlockingSource (unused).

This commit is contained in:
Mark Fisher
2008-10-01 18:47:42 +00:00
parent 7843007930
commit 5d5f502e8e
2 changed files with 1 additions and 62 deletions

View File

@@ -17,7 +17,6 @@
package org.springframework.integration.endpoint;
import org.springframework.integration.channel.MessageChannel;
import org.springframework.integration.message.BlockingSource;
import org.springframework.integration.message.Message;
import org.springframework.integration.message.MessageDeliveryAware;
import org.springframework.integration.message.MessageDeliveryException;
@@ -35,8 +34,6 @@ public class SourcePoller extends AbstractPoller {
private final MessageChannel channel;
private volatile long receiveTimeout = 1000;
public SourcePoller(MessageSource<?> source, MessageChannel channel, Trigger trigger) {
super(trigger);
@@ -47,22 +44,9 @@ public class SourcePoller extends AbstractPoller {
}
/**
* Specify the timeout to use when receiving from the source (in milliseconds).
* This value will only apply if the source is a {@link BlockingSource}.
* <p>
* A negative value indicates that receive calls should block indefinitely.
* The default value is 1000 (1 second).
*/
public void setReceiveTimeout(long receiveTimeout) {
this.receiveTimeout = receiveTimeout;
}
@Override
protected boolean doPoll() {
Message<?> message = (this.receiveTimeout >= 0 && this.source instanceof BlockingSource)
? ((BlockingSource<?>) this.source).receive(this.receiveTimeout)
: this.source.receive();
Message<?> message = this.source.receive();
if (message == null) {
return false;
}

View File

@@ -1,45 +0,0 @@
/*
* Copyright 2002-2008 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.
* You may obtain a copy of the License at
*
* 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,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.message;
/**
* Extends {@link PollableSource} and provides a timeout-aware receive method.
*
* @author Mark Fisher
*/
public interface BlockingSource<T> extends MessageSource<T> {
/**
* Receive a message, blocking indefinitely if necessary.
*
* @return the next available {@link Message} or <code>null</code> if
* interrupted
*/
Message<T> receive();
/**
* Receive a message, blocking until either a message is available or the
* specified timeout period elapses.
*
* @param timeout the timeout in milliseconds
*
* @return the next available {@link Message} or <code>null</code> if the
* specified timeout period elapses or the message reception is interrupted
*/
Message<T> receive(long timeout);
}