tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/common Shm.java
Date Thu, 02 May 2002 03:18:01 GMT
costin      02/05/01 20:18:01

  Modified:    jk/java/org/apache/jk/common Shm.java
  Log:
  Few more features. I think the sending part works fine now ( but we should
  still do more tunning ).
  
  For each tomcat instance we create a shm slot in the scoreboard. The
  slot is named TOMCAT:host:port ( host:port is used as instance ID ), and
  contains a ( ajp13-encoded ) structure with informations about the channels
  ( currently the socket and unix channel - jni is special ). It'll also
  include the groups where the instance belongs, and possibly other
  informations.
  
  If the number of channels is 0, the lb worker is supposed to stop
  sending new requests to the instance ( but keep forwarding the
  existing sessions ). That'll implement 'gracefull shutdown'.
  
  Still to add:
  - display ( nicely ) the information in the shm
  - read info from shm ( like slots owned by apache processes with
  statistics - in a future release )
  
  Revision  Changes    Path
  1.9       +27 -0     jakarta-tomcat-connectors/jk/java/org/apache/jk/common/Shm.java
  
  Index: Shm.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/Shm.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Shm.java	1 May 2002 22:40:17 -0000	1.8
  +++ Shm.java	2 May 2002 03:18:01 -0000	1.9
  @@ -95,6 +95,7 @@
   
       boolean unregister=false;
       boolean reset=false;
  +    String dumpFile=null;
       
       // Will be dynamic ( getMethodId() ) after things are stable 
       static final int SHM_SET_ATTRIBUTE=0;
  @@ -102,6 +103,8 @@
       static final int SHM_ATTACH=3;
       static final int SHM_DETACH=4;
       static final int SHM_RESET=5;
  +    static final int SHM_DUMP=6;
  +    static final int SHM_DESTROY=7;
       
       public Shm() {
       }
  @@ -112,6 +115,13 @@
           file=f;
       }
   
  +    /** Copy the scoreboard in a file for debugging
  +     *  Will also log a lot of information about what's in the scoreboard.
  +     */
  +    public void setDump( String dumpFile ) {
  +        this.dumpFile=dumpFile;
  +    }
  +    
       /** Size. Used only if the scoreboard is to be created.
        */
       public void setSize( int size ) {
  @@ -199,6 +209,20 @@
           this.invoke( msg, mCtx );
       }
   
  +    public void dumpScoreboard(String fname) throws IOException {
  +        if( apr==null ) return;
  +        MsgContext mCtx=createMsgContext();
  +        Msg msg=(Msg)mCtx.getMsg(0);
  +        C2BConverter c2b=(C2BConverter)mCtx.getNote(C2B_NOTE);
  +        msg.reset();
  +
  +        msg.appendByte( SHM_DUMP );
  +
  +        appendString( msg, fname, c2b);
  +        
  +        this.invoke( msg, mCtx );
  +    }
  +
       public void setNativeAttribute(String name, String val) throws IOException {
           if( apr==null ) return;
           MsgContext mCtx=createMsgContext();
  @@ -315,8 +339,11 @@
                   return;
               }
               init();
  +
               if( reset ) {
                   resetScoreboard();
  +            } else if( dumpFile!=null ) {
  +                dumpScoreboard(dumpFile);
               } else if( unregister ) {
                   unRegisterTomcat( host, port );
               } else {
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message