null
if no handler is registered under
+ * id
+ */
+ T get(short id);
+
+ /**
* Unregisters the handler associated with the specifed mux identifier
* @param id a mux id
*/
void remove(short id);
+
+ /**
+ * Gets the handler for messages that have no mux header.
+ *
+ * @return the default handler, or null
if no default handler
+ * has been set
+ */
+ T getDefaultHandler();
+
+ /**
+ * Sets the handler for messages that have no mux header.
+ *
+ * @param handler a handler for messages that have no mux header
+ */
+ void setDefaultHandler(T handler);
}
Index: src/org/jgroups/blocks/mux/MuxUpHandler.java
===================================================================
RCS file: /cvsroot/javagroups/JGroups/src/org/jgroups/blocks/mux/MuxUpHandler.java,v
retrieving revision 1.2
diff -u -r1.2 MuxUpHandler.java
--- src/org/jgroups/blocks/mux/MuxUpHandler.java 15 Apr 2010 20:05:22 -0000 1.2
+++ src/org/jgroups/blocks/mux/MuxUpHandler.java 6 Jun 2010 15:46:42 -0000
@@ -17,7 +17,7 @@
public class MuxUpHandler implements UpHandler, MuxercanReplace
+ * controls whether this method replaces it (after logging a WARN) or simply
+ * leaves handler
uninstalled.
+ *
+ * Passing false
as the canReplace
value allows
+ * callers to use this method to install defaults without concern about
+ * inadvertently overriding
+ *
+ * @param handler the UpHandler to install
+ * @param canReplace true
if an existing Channel upHandler or
+ * Muxer default upHandler can be replaced; false
+ * if this method shouldn't install
+ */
+ protected void installUpHandler(UpHandler handler, boolean canReplace)
+ {
+ UpHandler existing = channel.getUpHandler();
+ if (existing == null) {
+ channel.setUpHandler(handler);
+ }
+ else if (existing instanceof Muxer>) {
+ @SuppressWarnings("unchecked")
+ Muxer