You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@apache.org on 2001/08/31 06:11:56 UTC

cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util/buf MessageBytes.java TimeStamp.java

costin      01/08/30 21:11:56

  Modified:    src/share/org/apache/tomcat/util/buf MessageBytes.java
                        TimeStamp.java
  Log:
  Added a factory and newInstance method, as an alternative for new MessageBytes.
  
  That allows a different implementation of MessageBytes to be used, in case a specialized
  connector needs. By default the code operates exactly as before.
  
  Revision  Changes    Path
  1.6       +19 -0     jakarta-tomcat/src/share/org/apache/tomcat/util/buf/MessageBytes.java
  
  Index: MessageBytes.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/buf/MessageBytes.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- MessageBytes.java	2001/07/19 05:49:02	1.5
  +++ MessageBytes.java	2001/08/31 04:11:56	1.6
  @@ -99,6 +99,10 @@
       public MessageBytes() {
       }
   
  +    public static MessageBytes newInstance() {
  +	return factory.newInstance();
  +    }
  +    
       public void setCaseSenitive( boolean b ) {
   	caseSensitive=b;
       }
  @@ -570,5 +574,20 @@
   	hasIntValue=true;
   	return intValue;
       }
  +
  +    // -------------------- Future may be different --------------------
       
  +    private static MessageBytesFactory factory=new MessageBytesFactory();
  +
  +    public static void setFactory( MessageBytesFactory mbf ) {
  +	factory=mbf;
  +    }
  +    
  +    public static class MessageBytesFactory {
  +	protected MessageBytesFactory() {
  +	}
  +	public MessageBytes newInstance() {
  +	    return new MessageBytes();
  +	}
  +    }
   }
  
  
  
  1.5       +1 -1      jakarta-tomcat/src/share/org/apache/tomcat/util/buf/TimeStamp.java
  
  Index: TimeStamp.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/buf/TimeStamp.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TimeStamp.java	2001/07/19 05:49:02	1.4
  +++ TimeStamp.java	2001/08/31 04:11:56	1.5
  @@ -115,7 +115,7 @@
        *  The name is a MessageBytes - i.e. a modifiable byte[] or char[]. 
        */
       public MessageBytes getName() {
  -	if( name==null ) name=new MessageBytes();//lazy
  +	if( name==null ) name=MessageBytes.newInstance();//lazy
   	return name;
       }