You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by "Peter M. Goldstein" <pe...@yahoo.com> on 2002/07/31 08:26:11 UTC

[PATCH] SMTPHandler.java

All,

I'm submitting this change before all of the other String concatenation
=> StringBuffer related changes because:

i) I've added a lot of comments and other minor changes to this file
that would be difficult to integrate with other changes

ii) There are a couple of outstanding issues that need to be addressed
that will touch SMTPHandler.java in the near future

The specific changes include:

All methods and variables were documented, if only minimally.

A couple of instance variables were converted to static variables -
softwareType, which is just a String describing the SMTPHandler, is now
static.  The SMTP ID generating variable random is now static.  There is
synchronized access to this variable to ensure thread safety.
 
Unused variables were removed from the class definition.  These included
count, connNumber, and remoteHostGiven.  Note that count and connNumber
as previously defined were not thread safe (increment operations on
longs are not thread safe)

All string concatenations involving more than two strings were converted
into StringBuffer expressions.  Strings are now concatenated using the
append method of the StringBuffer class.  Two string concatenations were
not converted because there is no significant performance increase
associated with that conversion.  This is a resolution for bug #11235 as
far as this file is concerned.

Some wrappers were added to a number of the logging statements.  These
wrappers check if the logger being used supports the logging level
before constructing the composite string to be sent to the logger.  This
makes the handler more efficient when running in non-DEBUG mode.

The responses sent by the SMTP handler are now logged at a DEBUG log
level.  Before, only the commands received from the client were logged.
IMHO this made it difficult to debug the SMTP exchange in certain
circumstances.  So I added code to record this side of the
communication.

The commands received from the client are now logged at a DEBUG log
level, rather than at the INFO level.  This seemed more appropriate for
this sort of low level communication.  Each incoming connection is still
recorded at an INFO level in the log.

Flush statements were added at several points to ensure that the server
responses are sent to the client in a timely fashion.

Sorry there are so many changes at once, but I really didn't see an
effective way to do (and submit) these independently.  Any thoughts?
Comments?  Critiques?

--Peter


RE: [PATCH] SMTPHandler.java

Posted by "Peter M. Goldstein" <pe...@yahoo.com>.
All,

Any thoughts, comments, critiques to this patch?  I'd like to get some
feedback to this and the patches I'll be submitting shortly...

--Peter

> -----Original Message-----
> From: Peter M. Goldstein [mailto:peter_m_goldstein@yahoo.com]
> Sent: Tuesday, July 30, 2002 11:26 PM
> To: james-dev@jakarta.apache.org
> Subject: [PATCH] SMTPHandler.java
> 
> All,
> 
> I'm submitting this change before all of the other String
concatenation
> => StringBuffer related changes because:
> 
> i) I've added a lot of comments and other minor changes to this file
> that would be difficult to integrate with other changes
> 
> ii) There are a couple of outstanding issues that need to be addressed
> that will touch SMTPHandler.java in the near future
> 
> The specific changes include:
> 
> All methods and variables were documented, if only minimally.
> 
> A couple of instance variables were converted to static variables -
> softwareType, which is just a String describing the SMTPHandler, is
now
> static.  The SMTP ID generating variable random is now static.  There
is
> synchronized access to this variable to ensure thread safety.
> 
> Unused variables were removed from the class definition.  These
included
> count, connNumber, and remoteHostGiven.  Note that count and
connNumber
> as previously defined were not thread safe (increment operations on
> longs are not thread safe)
> 
> All string concatenations involving more than two strings were
converted
> into StringBuffer expressions.  Strings are now concatenated using the
> append method of the StringBuffer class.  Two string concatenations
were
> not converted because there is no significant performance increase
> associated with that conversion.  This is a resolution for bug #11235
as
> far as this file is concerned.
> 
> Some wrappers were added to a number of the logging statements.  These
> wrappers check if the logger being used supports the logging level
> before constructing the composite string to be sent to the logger.
This
> makes the handler more efficient when running in non-DEBUG mode.
> 
> The responses sent by the SMTP handler are now logged at a DEBUG log
> level.  Before, only the commands received from the client were
logged.
> IMHO this made it difficult to debug the SMTP exchange in certain
> circumstances.  So I added code to record this side of the
> communication.
> 
> The commands received from the client are now logged at a DEBUG log
> level, rather than at the INFO level.  This seemed more appropriate
for
> this sort of low level communication.  Each incoming connection is
still
> recorded at an INFO level in the log.
> 
> Flush statements were added at several points to ensure that the
server
> responses are sent to the client in a timely fashion.
> 
> Sorry there are so many changes at once, but I really didn't see an
> effective way to do (and submit) these independently.  Any thoughts?
> Comments?  Critiques?
> 
> --Peter




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>