Hi all,
I would like to thank you for helping me with my first question about
synchronizing access to the session object. My thoughts now are that it is
better to be safe than sorry and synchronize all access to the session
object.
I have another question which causes me to re-think part of my design:
I have a class that manages a log file which all objects within the system
can write messages to. The class utilises the Singleton Instance design
pattern so only one instance is accessible. The main method that writes the
message to the log file is synchronized. Here is the skeleton class:
public class EventLogController {
public static EventLogController getInstance()
{
//Singleton implementation
}
public synchronized boolean writeToEventLog(String fileName, String
message)
{
//write to file
}
}//end class
Question:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Should I still use this approach or should I create the writeToEventLog as
static thus removing the need to kept an instance of the class.
Best Regards
Marc
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html