costin      2003/01/10 23:08:33

  Modified:    coyote/src/java/org/apache/coyote BaseHook.java
  Log:
  Added NotificationListener.
  
  JMX notifications are not as flexible - I really don't know
  what is the best solution here. Less flexibility might be very
  good - it can keep things simpler.
  
  I'll add a BaseNotification to modeler - with an int code,
  notes, etc. And then I'll try to find a way to use standard
  notifications side-by-side with the native mechanism ( ActionCode ).
  
  Opinions ?? I'm not very sure...
  
  Revision  Changes    Path
  1.2       +26 -4     
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/BaseHook.java
  
  Index: BaseHook.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/BaseHook.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BaseHook.java     10 Jan 2003 22:36:43 -0000      1.1
  +++ BaseHook.java     11 Jan 2003 07:08:33 -0000      1.2
  @@ -61,6 +61,8 @@
   import javax.management.MBeanRegistration;
   import javax.management.ObjectName;
   import javax.management.MBeanServer;
  +import javax.management.NotificationListener;
  +import javax.management.Notification;
   
   
   /**
  @@ -69,21 +71,33 @@
    * @author Remy Maucherat
    * @author Costin Manolache
    */
  -public class BaseHook implements ActionHook, MBeanRegistration {
  +public class BaseHook
  +        implements ActionHook, MBeanRegistration, NotificationListener
  + {
       protected BaseHook next;
   
       /**
  +     * XXX DO WE REALLY NEED THIS ? handleNotification should be enough !!
  +     *
        * Send an action to the connector.
        * Both recursive and iterative invocation is possible - the
        * hook may call itself the next hook ( like catalina ) or the
        * controller may call the next.
  -     * 
  +     *
  +     * The call pattern for this is:
  +     *   while( hook!=null ) {
  +     *      hook=action( code, param );
  +     *   }
  +     * If the hooks has special needs - it can call next itself and decide
  +     * to return null or whatever the next hook returned.
  +     *
  +     * The reason for iterative calls - smaller stacks ( and stack traces ).
  +     *
        * @param param Action parameter
        * @return  A hook that can be executed next.
        */
       public BaseHook action(int code, Object param) {
  -        if( next==null ) return next;
  -        return next.action( code, param );
  +        return next;
       };
   
       /** Backward compat
  @@ -134,5 +148,13 @@
       public void postDeregister() {
       }
   
  +    // -------------------- Notification listener  --------------------
  +
  +    public void handleNotification(Notification notification, Object handback) {
  +        // we need a special CoyoteNotification that will include the code
  +        // and param.
  +
  +        // It would be better to use a generic class in modeler.
  +    }
   
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to