Re: Global Data
Partha Ranjan Das <[email protected]> Thu, 1 Sep 2005 10:53:33 +0530
| Newsgroups | gmane.comp.java.sun.servlet |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format.
------_=_NextPart_001_01C5AEB5.4D5B249C
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Singleton pattern will have problems when the web tier has multiple =
classloaders, when there may be multiple instances of the singleton. So =
take the help of the container... use an application object for stroing =
the common object and not a singleton.
Regards,
Partha
-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet =
API Technology. [mailto:[email protected]]On Behalf Of Chris =
Pratt
Sent: Thursday, September 01, 2005 10:13 AM
To: [email protected]
Subject: Re: Global Data
Use the static singleton pattern to construct a States object to hold =
the static data. Make sure it has some method to allow it to be =
reloaded on the fly. Then add an extra web page to your web app =
(possibly with higher security) that allows you to reload the States =
singleton after you've updated the database. Or even better have that =
page present you with a form to add the new State to both the singleton =
and the database in one fell-swoop.
(*Chris*)
On 8/31/05, SUBSCRIBE EJB-INTEREST anonymous < [email protected]> wrote:=20
Hi,
I have a question.
In my web application, when the user logs in, I have to load all State
information from the database and display it.The State information will =
be
common to all users.I would add new States into the database table.=20
My question is what is the best way to get the state information from
database and store it globally,so that, it can be shared by all users.
If I use servlet for this, and load the state information in the init(), =
I=20
have to restart the server whenever I add new state information to the
database, inorder to get the new states.I don't want the server to get
restarted whenever I add state information to database.SO, this option =
is=20
not feasible.
Is there any other way to do this?
Any ideas/suggestions to resolve this issue would be very helpful for =
me.
Thanks in advance.
_________________________________________________________________________=
__=20
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".=20
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=20
___________________________________________________________________________
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
------_=_NextPart_001_01C5AEB5.4D5B249C
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1106" name=3DGENERATOR></HEAD>
<BODY>
<DIV><SPAN class=3D816551705-01092005><FONT face=3DArial color=3D#0000ff =
size=3D2>Singleton pattern will have problems when the web tier has =
multiple=20
classloaders, when there may be multiple instances of the singleton. So =
take the=20
help of the container... use an application object for stroing the =
common object=20
and not a singleton.</FONT></SPAN></DIV>
<DIV><SPAN class=3D816551705-01092005><FONT face=3DArial color=3D#0000ff =
size=3D2>Regards,</FONT></SPAN></DIV>
<DIV><SPAN class=3D816551705-01092005><FONT face=3DArial color=3D#0000ff =
size=3D2>Partha</FONT></SPAN></DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px">
<DIV class=3DOutlookMessageHeader dir=3Dltr align=3Dleft><FONT =
face=3DTahoma=20
size=3D2>-----Original Message-----<BR><B>From:</B> A mailing list for =
discussion about Sun Microsystem's Java Servlet API Technology.=20
[mailto:[email protected]]<B>On Behalf Of </B>Chris=20
Pratt<BR><B>Sent:</B> Thursday, September 01, 2005 10:13 =
AM<BR><B>To:</B>=20
[email protected]<BR><B>Subject:</B> Re: Global=20
Data<BR><BR></FONT></DIV>Use the static singleton pattern to construct =
a=20
States object to hold the static data. Make sure it has some =
method to=20
allow it to be reloaded on the fly. Then add an extra web page =
to your=20
web app (possibly with higher security) that allows you to reload the =
States=20
singleton after you've updated the database. Or even better have =
that=20
page present you with a form to add the new State to both the =
singleton and=20
the database in one fell-swoop.<BR> (*Chris*)<BR><BR>
<DIV><SPAN class=3Dgmail_quote>On 8/31/05, <B =
class=3Dgmail_sendername>SUBSCRIBE=20
EJB-INTEREST anonymous</B> <<A=20
href=3D"mailto:[email protected]">[email protected]</A>> =
wrote:</SPAN>
<BLOCKQUOTE class=3Dgmail_quote=20
style=3D"PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: =
rgb(204,204,204) 1px solid">Hi,<BR>I=20
have a question.<BR>In my web application, when the user logs in, I =
have to=20
load all State<BR>information from the database and display it.The =
State=20
information will be<BR>common to all users.I would add new States =
into the=20
database table. <BR>My question is what is the best way to get the =
state=20
information from<BR>database and store it globally,so that, it can =
be shared=20
by all users.<BR><BR>If I use servlet for this, and load the state=20
information in the init(), I <BR>have to restart the server whenever =
I add=20
new state information to the<BR>database, inorder to get the new =
states.I=20
don't want the server to get<BR>restarted whenever I add state =
information=20
to database.SO, this option is <BR>not feasible.<BR>Is there any =
other way=20
to do this?<BR><BR>Any ideas/suggestions to resolve this issue would =
be very=20
helpful for me.<BR><BR>Thanks in=20
=
advance.<BR><BR>_________________________________________________________=
__________________=20
<BR>To unsubscribe, send email to <A=20
href=3D"mailto:[email protected]">[email protected]</A> and =
include in=20
the body<BR>of the message "signoff =
SERVLET-INTEREST".<BR><BR>Archives: <A=20
=
href=3D"http://archives.java.sun.com/archives/servlet-interest.html">http=
://archives.java.sun.com/archives/servlet-interest.html</A><BR>Resources:=
=20
<A=20
=
href=3D"http://java.sun.com/products/servlet/external-resources.html">htt=
p://java.sun.com/products/servlet/external-resources.html</A><BR>LISTSERV=
=20
Help: <A=20
=
href=3D"http://www.lsoft.com/manuals/user/user.html">http://www.lsoft.com=
/manuals/user/user.html</A><BR></BLOCKQUOTE></DIV><BR>___________________=
________________________________________________________=20
To unsubscribe, send email to [email protected] and include in the =
body of=20
the message "signoff SERVLET-INTEREST".=20
<P>Archives: =
http://archives.java.sun.com/archives/servlet-interest.html=20
Resources: =
http://java.sun.com/products/servlet/external-resources.html=20
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html=20
<P></P></BLOCKQUOTE></BODY></HTML>
___________________________________________________________________________
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff SERVLET-INTEREST".
<p>
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
<p>
------_=_NextPart_001_01C5AEB5.4D5B249C--