diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/dispatcher/FailOverDispatcher.java b/org.springframework.integration/src/main/java/org/springframework/integration/dispatcher/FailOverDispatcher.java
index 8a5fc736df..4823e2f5e7 100644
--- a/org.springframework.integration/src/main/java/org/springframework/integration/dispatcher/FailOverDispatcher.java
+++ b/org.springframework.integration/src/main/java/org/springframework/integration/dispatcher/FailOverDispatcher.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 the original author or authors.
+ * Copyright 2002-2009 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.
@@ -16,24 +16,51 @@
package org.springframework.integration.dispatcher;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
+import org.springframework.core.OrderComparator;
import org.springframework.integration.message.MessageHandler;
+import org.springframework.util.Assert;
/**
- * {@link AbstractUnicastDispatcher} that will try it's handlers in the
+ * {@link AbstractUnicastDispatcher} that will try its handlers in the
* same order every dispatch.
*
+ *
The {@link Comparator} that determines the order may be provided via the
+ * {@link #setComparator(Comparator)} method. If none is provided, the default
+ * will be an instance of {@link OrderComparator}, and any {@link MessageHandler}
+ * that implements {@link org.springframework.core.Ordered} will be ordered
+ * accordingly. Any other handlers will be placed at the end of the list.
+ *
* @author Mark Fisher
* @author Iwein Fuld
*/
public class FailOverDispatcher extends AbstractUnicastDispatcher {
+ @SuppressWarnings("unchecked")
+ private Comparator