diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/channel/AsyncMessageChannelTemplate.java b/org.springframework.integration/src/main/java/org/springframework/integration/channel/AsyncMessageChannelTemplate.java deleted file mode 100644 index aef21d6228..0000000000 --- a/org.springframework.integration/src/main/java/org/springframework/integration/channel/AsyncMessageChannelTemplate.java +++ /dev/null @@ -1,89 +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.channel; - -import java.util.concurrent.Callable; -import java.util.concurrent.FutureTask; - -import org.springframework.core.task.TaskExecutor; -import org.springframework.integration.message.AsyncMessage; -import org.springframework.integration.message.Message; -import org.springframework.util.Assert; - -/** - * An asynchronous version of the {@link MessageChannelTemplate}. - * - * @author Mark Fisher - */ -public class AsyncMessageChannelTemplate extends MessageChannelTemplate { - - private final TaskExecutor taskExecutor; - - - public AsyncMessageChannelTemplate(TaskExecutor taskExecutor) { - Assert.notNull(taskExecutor, "TaskExecutor must not be null"); - this.taskExecutor = taskExecutor; - } - - - /** - * Send the provided message to the given channel. Note that the actual - * sending occurs asynchronously, so this method will always return - * true unless an exception is thrown by the executor. - */ - @Override - public boolean send(final Message message, final MessageChannel channel) { - this.taskExecutor.execute(new Runnable() { - public void run() { - AsyncMessageChannelTemplate.super.send(message, channel); - } - }); - return true; - } - - /** - * Send the provided message to the given channel and receive the - * result as an {@link AsyncMessage}. - */ - @Override - @SuppressWarnings("unchecked") - public Message sendAndReceive(final Message request, final MessageChannel channel) { - FutureTask> task = new FutureTask>(new Callable>() { - public Message call() throws Exception { - return AsyncMessageChannelTemplate.super.sendAndReceive(request, channel); - } - }); - this.taskExecutor.execute(task); - return new AsyncMessage(task); - } - - /** - * Receive an {@link AsyncMessage} from the provided channel. - */ - @Override - @SuppressWarnings("unchecked") - public Message receive(final PollableChannel channel) { - FutureTask> task = new FutureTask>(new Callable>() { - public Message call() throws Exception { - return AsyncMessageChannelTemplate.super.receive(channel); - } - }); - this.taskExecutor.execute(task); - return new AsyncMessage(task); - } - -}