geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdam...@apache.org
Subject cvs commit: incubator-geronimo/modules/network/src/java/org/apache/geronimo/network/protocol ProtocolFactory.java
Date Mon, 19 Apr 2004 16:34:06 GMT
gdamour     2004/04/19 09:34:06

  Modified:    modules/network/src/java/org/apache/geronimo/network/protocol
                        ProtocolFactory.java
  Log:
  Provide a call-back to track the creation of a new protocol stack.
  
  A client can use this mechanism to set-up a specific handler for the
  highest protocol of the acceptable protocol stack.
  
  Revision  Changes    Path
  1.5       +34 -1     incubator-geronimo/modules/network/src/java/org/apache/geronimo/network/protocol/ProtocolFactory.java
  
  Index: ProtocolFactory.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/network/src/java/org/apache/geronimo/network/protocol/ProtocolFactory.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ProtocolFactory.java	17 Mar 2004 03:11:59 -0000	1.4
  +++ ProtocolFactory.java	19 Apr 2004 16:34:06 -0000	1.5
  @@ -36,6 +36,16 @@
   
       private final static Log log = LogFactory.getLog(ProtocolFactory.class);
   
  +    /**
  +     * Null AcceptedCallBack.
  +     */
  +    private final static AcceptedCallBack NULL_CALLBACK =
  +        new AcceptedCallBack() {
  +            public void accepted(AcceptableProtocol aProtocol) {
  +            }
  +        };
  +    
  +    private AcceptedCallBack callBack = NULL_CALLBACK;
       private AcceptableProtocol template;
       private ClockPool clockPool;
       private Map connectionCache = new Hashtable();
  @@ -45,6 +55,14 @@
       private long maxInactivity;
   
   
  +    public AcceptedCallBack getAcceptedCallBack() {
  +        return callBack;
  +    }
  +    
  +    public void setAcceptedCallBack(AcceptedCallBack aCallBack) {
  +        callBack = aCallBack;
  +    }
  +    
       public AcceptableProtocol getTemplate() {
           return template;
       }
  @@ -89,6 +107,7 @@
           try {
               AcceptableProtocol protocol = (AcceptableProtocol) template.cloneProtocol();
               protocol.accept(socketChannel);
  +            callBack.accepted(protocol);
               protocol.setup();
   
               Long id = new Long(nextConnectionId++);
  @@ -128,6 +147,20 @@
   
       }
   
  +    /**
  +     * When the AcceptableProtocol template is cloned and just before to be
  +     * set-up with the SocketChannel being accepted, the following call-back
  +     * is performed.
  +     * <BR>
  +     * A client may use this call-back to monitor the creation of a new protocol
  +     * stack bound to a client/connection and set-up a specific handler for the
  +     * highest protocol of the stack.
  +     */
  +    public interface AcceptedCallBack {
  +        public void accepted(AcceptableProtocol aProtocol)
  +            throws ProtocolException;
  +    }
  +    
       /**
        * This class periodically checks one login module.
        */
  
  
  

Mime
View raw message