tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@locus.apache.org
Subject cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/core ContextManager.java
Date Mon, 01 May 2000 23:25:46 GMT
costin      00/05/01 16:25:45

  Modified:    src/share/org/apache/tomcat/core ContextManager.java
  Log:
  Small change to the "notes" - the note is similar with attributes, but with
  faster access time ( indexed array access versus String-keyed Hashtables).
  We can also keep attributes visible from servlets separated from internal
  attributes.
  
  Revision  Changes    Path
  1.76      +13 -6     jakarta-tomcat/src/share/org/apache/tomcat/core/ContextManager.java
  
  Index: ContextManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ContextManager.java,v
  retrieving revision 1.75
  retrieving revision 1.76
  diff -u -r1.75 -r1.76
  --- ContextManager.java	2000/04/26 18:57:35	1.75
  +++ ContextManager.java	2000/05/01 23:25:44	1.76
  @@ -856,7 +856,7 @@
       public static final int CONTAINER_NOTE=1;
       public static final int REQUEST_NOTE=2;
       
  -    String noteDescription[][]=new String[3][MAX_NOTES];
  +    String noteName[][]=new String[3][MAX_NOTES];
   
       /** used to allow interceptors to set specific per/request, per/container
        * and per/CM informations.
  @@ -874,18 +874,25 @@
        *  all notes that it needs. 
        *
        *  Throws exception if too many notes are set ( shouldn't happen in normal use ).
  -     *  @param description of the note
  +     *  @param noteType The note will be associated with the server, container or request.
  +     *  @param name the name of the note.
        */
  -    public synchronized int getNoteId( int noteType, String description )
  +    public synchronized int getNoteId( int noteType, String name )
   	throws TomcatException
       {
  +	// find if we already have a note with this name ( this is in init(), not critical )
  +	for( int i=0; i< noteId[noteType] ; i++ ) {
  +	    if( noteName[noteType][i].equals( name ) )
  +		return i;
  +	}
  +	
   	if( noteId[noteType] >= MAX_NOTES ) throw new TomcatException( "Too many notes ");
  -	noteDescription[noteType][ noteId[noteType] ]=description;
  +	noteName[noteType][ noteId[noteType] ]=name;
   	return noteId[noteType]++;
       }
   
  -    public String getNoteDescription( int noteType, int noteId ) {
  -	return noteDescription[noteType][noteId];
  +    public String getNoteName( int noteType, int noteId ) {
  +	return noteName[noteType][noteId];
       }
       
       // -------------------- Per-server notes -------------------- 
  
  
  

Mime
View raw message