directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r325854 - in /directory/network: branches/0.7/src/java/org/apache/mina/protocol/handler/DemuxingProtocolHandler.java trunk/src/java/org/apache/mina/handler/DemuxingIoHandler.java
Date Mon, 17 Oct 2005 07:30:12 GMT
Author: trustin
Date: Mon Oct 17 00:29:56 2005
New Revision: 325854

URL: http://svn.apache.org/viewcvs?rev=325854&view=rev
Log:
Added some return value to (add|remove)MessageHandler() methods


Modified:
    directory/network/branches/0.7/src/java/org/apache/mina/protocol/handler/DemuxingProtocolHandler.java
    directory/network/trunk/src/java/org/apache/mina/handler/DemuxingIoHandler.java

Modified: directory/network/branches/0.7/src/java/org/apache/mina/protocol/handler/DemuxingProtocolHandler.java
URL: http://svn.apache.org/viewcvs/directory/network/branches/0.7/src/java/org/apache/mina/protocol/handler/DemuxingProtocolHandler.java?rev=325854&r1=325853&r2=325854&view=diff
==============================================================================
--- directory/network/branches/0.7/src/java/org/apache/mina/protocol/handler/DemuxingProtocolHandler.java
(original)
+++ directory/network/branches/0.7/src/java/org/apache/mina/protocol/handler/DemuxingProtocolHandler.java
Mon Oct 17 00:29:56 2005
@@ -38,24 +38,29 @@
     /**
      * Registers a {@link MessageHandler} that receives the messages of
      * the specified <code>type</code>.
+     * 
+     * @return the old handler if there is already a registered handler for
+     *         the specified <tt>type</tt>.  <tt>null</tt> otherwise.
      */
-    public void addMessageHandler( Class type, MessageHandler handler )
+    public MessageHandler addMessageHandler( Class type, MessageHandler handler )
     {
         synchronized( type2handler )
         {
-            type2handler.put( type, handler );
+            return ( MessageHandler ) type2handler.put( type, handler );
         }
     }
 
     /**
      * Deregisters a {@link MessageHandler} that receives the messages of
      * the specified <code>type</code>.
+     * 
+     * @return the removed handler if successfully removed.  <tt>null</tt> otherwise.
      */
-    public void removeMessageHandler( Class type )
+    public MessageHandler removeMessageHandler( Class type )
     {
         synchronized( type2handler )
         {
-            type2handler.remove( type );
+            return (MessageHandler) type2handler.remove( type );
         }
     }
     

Modified: directory/network/trunk/src/java/org/apache/mina/handler/DemuxingIoHandler.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/handler/DemuxingIoHandler.java?rev=325854&r1=325853&r2=325854&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/handler/DemuxingIoHandler.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/handler/DemuxingIoHandler.java Mon Oct
17 00:29:56 2005
@@ -38,24 +38,29 @@
     /**
      * Registers a {@link MessageHandler} that receives the messages of
      * the specified <code>type</code>.
+     * 
+     * @return the old handler if there is already a registered handler for
+     *         the specified <tt>type</tt>.  <tt>null</tt> otherwise.
      */
-    public void addMessageHandler( Class type, MessageHandler handler )
+    public MessageHandler addMessageHandler( Class type, MessageHandler handler )
     {
         synchronized( type2handler )
         {
-            type2handler.put( type, handler );
+            return ( MessageHandler ) type2handler.put( type, handler );
         }
     }
 
     /**
      * Deregisters a {@link MessageHandler} that receives the messages of
      * the specified <code>type</code>.
+     * 
+     * @return the removed handler if successfully removed.  <tt>null</tt> otherwise.
      */
-    public void removeMessageHandler( Class type )
+    public MessageHandler removeMessageHandler( Class type )
     {
         synchronized( type2handler )
         {
-            type2handler.remove( type );
+            return ( MessageHandler ) type2handler.remove( type );
         }
     }
     



Mime
View raw message