directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: rev 56429 - in incubator/directory/seda/trunk/src/java/org/apache/seda: listener protocol
Date Tue, 02 Nov 2004 22:41:44 GMT
Author: akarasulu
Date: Tue Nov  2 14:41:43 2004
New Revision: 56429

Modified:
   incubator/directory/seda/trunk/src/java/org/apache/seda/listener/ClientKey.java
   incubator/directory/seda/trunk/src/java/org/apache/seda/listener/TCPClientKey.java
   incubator/directory/seda/trunk/src/java/org/apache/seda/listener/UDPClientKey.java
   incubator/directory/seda/trunk/src/java/org/apache/seda/protocol/DefaultRequestProcessor.java
   incubator/directory/seda/trunk/src/java/org/apache/seda/protocol/ManyReplyHandler.java
   incubator/directory/seda/trunk/src/java/org/apache/seda/protocol/NoReplyHandler.java
   incubator/directory/seda/trunk/src/java/org/apache/seda/protocol/SingleReplyHandler.java
Log:
Changes ...

 o made the ClientKey an Observable
 o Obervers of ClientKey are informed of updates when the key expires
 o notification triggered in TCP/UDP concrete classes
 o changed handlers to take a Client in the handle() method



Modified: incubator/directory/seda/trunk/src/java/org/apache/seda/listener/ClientKey.java
==============================================================================
--- incubator/directory/seda/trunk/src/java/org/apache/seda/listener/ClientKey.java	(original)
+++ incubator/directory/seda/trunk/src/java/org/apache/seda/listener/ClientKey.java	Tue Nov
 2 14:41:43 2004
@@ -20,6 +20,7 @@
 import java.io.IOException;
 
 import java.net.InetSocketAddress;
+import java.util.Observable;
 
 
 /**
@@ -41,7 +42,7 @@
  * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public abstract class ClientKey
+public abstract class ClientKey extends Observable
 {
     // ----------------------------------------------
     // Private members.

Modified: incubator/directory/seda/trunk/src/java/org/apache/seda/listener/TCPClientKey.java
==============================================================================
--- incubator/directory/seda/trunk/src/java/org/apache/seda/listener/TCPClientKey.java	(original)
+++ incubator/directory/seda/trunk/src/java/org/apache/seda/listener/TCPClientKey.java	Tue
Nov  2 14:41:43 2004
@@ -153,6 +153,9 @@
         {
             socket.close();
         }
+
+        super.setChanged();
+        super.notifyObservers();
     }
 
     /**

Modified: incubator/directory/seda/trunk/src/java/org/apache/seda/listener/UDPClientKey.java
==============================================================================
--- incubator/directory/seda/trunk/src/java/org/apache/seda/listener/UDPClientKey.java	(original)
+++ incubator/directory/seda/trunk/src/java/org/apache/seda/listener/UDPClientKey.java	Tue
Nov  2 14:41:43 2004
@@ -155,6 +155,9 @@
         {
             socket.close();
         }
+
+        super.setChanged();
+        super.notifyObservers();
     }
 
     /**

Modified: incubator/directory/seda/trunk/src/java/org/apache/seda/protocol/DefaultRequestProcessor.java
==============================================================================
--- incubator/directory/seda/trunk/src/java/org/apache/seda/protocol/DefaultRequestProcessor.java
(original)
+++ incubator/directory/seda/trunk/src/java/org/apache/seda/protocol/DefaultRequestProcessor.java
Tue Nov  2 14:41:43 2004
@@ -59,9 +59,8 @@
      * @param router the event router we subscribe and publish to
      * @param config the configuration for this stage
      */
-    public DefaultRequestProcessor(
-                                   EventRouter router, StageConfig config,
-                                   InetServicesDatabase inetDb)
+    public DefaultRequestProcessor( EventRouter router, StageConfig config,
+                                    InetServicesDatabase inetDb )
     {
         super(config);
 
@@ -136,14 +135,13 @@
      * @param handler the handler that generates the responses
      * @param request the request responded to
      */
-    private void reply(
-                       ManyReplyHandler handler, Object request, ClientKey key)
+    private void reply( ManyReplyHandler handler, Object request, ClientKey key )
     {
         Object response = null;
 
         try
         {
-            Iterator list = handler.handle(request);
+            Iterator list = handler.handle(key, request);
 
             if (handler.isSequential())
             {
@@ -178,15 +176,14 @@
      * @param handler the handler that generates the single response
      * @param request the request responded to
      */
-    private void reply(
-                       SingleReplyHandler handler, Object request,
-                       ClientKey key)
+    private void reply( SingleReplyHandler handler, Object request,
+                        ClientKey key )
     {
         Object response = null;
 
         try
         {
-            response = handler.handle(request);
+            response = handler.handle(key, request);
         }
 
         // If the individual handlers do not do a global catch and report this
@@ -221,7 +218,7 @@
             case (HandlerTypeEnum.NOREPLY_VAL):
 
                 NoReplyHandler noreply = (NoReplyHandler) handler;
-                noreply.handle(event.getRequest());
+                noreply.handle(key, event.getRequest());
                 break;
 
             case (HandlerTypeEnum.SINGLEREPLY_VAL):

Modified: incubator/directory/seda/trunk/src/java/org/apache/seda/protocol/ManyReplyHandler.java
==============================================================================
--- incubator/directory/seda/trunk/src/java/org/apache/seda/protocol/ManyReplyHandler.java
(original)
+++ incubator/directory/seda/trunk/src/java/org/apache/seda/protocol/ManyReplyHandler.java
Tue Nov  2 14:41:43 2004
@@ -19,6 +19,8 @@
 
 import java.util.Iterator;
 
+import org.apache.seda.listener.ClientKey;
+
 
 /**
  * A handler for requests that can generate zero, one or more responses.
@@ -32,10 +34,11 @@
      * A handler for a request that can create multiple responses of
      * heterogenous messages.
      *
+     * @param key the client's unique key
      * @param request the request that may generate many replies
      * @return an enumeration over the responses
      */
-    Iterator handle(Object request);
+    Iterator handle(ClientKey key, Object request);
 
     /**
      * Determinates whether or not a multi-reply request's responses should be

Modified: incubator/directory/seda/trunk/src/java/org/apache/seda/protocol/NoReplyHandler.java
==============================================================================
--- incubator/directory/seda/trunk/src/java/org/apache/seda/protocol/NoReplyHandler.java	(original)
+++ incubator/directory/seda/trunk/src/java/org/apache/seda/protocol/NoReplyHandler.java	Tue
Nov  2 14:41:43 2004
@@ -18,6 +18,9 @@
 package org.apache.seda.protocol;
 
 
+import org.apache.seda.listener.ClientKey;
+
+
 /**
  * Represents handlers that do not return a response to the client.
  *
@@ -30,7 +33,8 @@
      * Handles requests that do not reply to the requesting client with a
      * response.
      *
+     * @param key the client's unique key
      * @param request the request without a response.
      */
-    void handle(Object request);
+    void handle(ClientKey key, Object request);
 }

Modified: incubator/directory/seda/trunk/src/java/org/apache/seda/protocol/SingleReplyHandler.java
==============================================================================
--- incubator/directory/seda/trunk/src/java/org/apache/seda/protocol/SingleReplyHandler.java
(original)
+++ incubator/directory/seda/trunk/src/java/org/apache/seda/protocol/SingleReplyHandler.java
Tue Nov  2 14:41:43 2004
@@ -18,6 +18,9 @@
 package org.apache.seda.protocol;
 
 
+import org.apache.seda.listener.ClientKey;
+
+
 /**
  * Request handler signature for those requests that generate a single response
  * for a request.
@@ -31,8 +34,9 @@
      * Handles a request that generates a sole response by returning the
      * response object back to the caller.
      *
+     * @param key the client's unique key
      * @param request the request to handle.
      * @return the response to the request argument.
      */
-    Object handle(Object request);
+    Object handle(ClientKey key, Object request);
 }

Mime
View raw message