Here is a simple example of singleton object:
public class Cache
{
// A simple example of using map as cache which is impractical
protected static Map m_collection;
private static Cache m_instance;
private Cache()
{
this.m_instance = null;
m_collection = new TreeMap();
}
public static CompactDiskCollection getInstance()
{
if (m_instance == null)
m_instance = new Cache();
return m_instance;
}
}
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD>
> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
> <TITLE>Implementation of a buffer. Sessions and threads timeouts</TITLE>
>
> <META content="MSHTML 5.50.4134.600" name=GENERATOR></HEAD>
> <BODY>
> <DIV><SPAN class8465912-20122001><FONT color=#0000ff>Hi
> Jim,</FONT></SPAN></DIV>
> <DIV><SPAN class8465912-20122001><FONT
> color=#0000ff></FONT></SPAN>=a0</DIV>
> <DIV><SPAN class8465912-20122001><FONT color=#0000ff>Thanks for the
> answer!</FONT></SPAN></DIV>
> <DIV><SPAN class8465912-20122001><FONT color=#0000ff>What do you mean
> with
> "<FONT face=Arial size=2>singleton object</FONT>"?</FONT></SPAN></DIV>
> <DIV><SPAN class8465912-20122001><FONT color=#0000ff>Do you have an
> example,
> or can you tell me something about it?</FONT></SPAN></DIV>
> <DIV><SPAN class8465912-20122001><FONT
> color=#0000ff>Thanks!</FONT></SPAN></DIV>
> <DIV>=a0</DIV></BODY></HTML>
>
> _________________________________________________________________________
> __
> 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
>
___________________________________________________________________________
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