Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » J2EE Interest »

Re: Static block issue.

Sandeep Gain

2004-09-29


Manish,

You are right. Static blocks are executed only once when your class is first
referenced.

-Sandeep

Sandeep Gain
Senior Member Technical Staff,
Andale Information Technologies Pvt Ltd.
Web: http://www.andale.com


-----Original Message-----
From: Manish Malhotra [mailto:manish.mmalhotra@(protected)]
Sent: Wednesday, September 29, 2004 12:38 PM
To: J2EE-INTEREST@(protected)
Subject: Static block issue.

Hi All,

If Im creating an object from a Session Bean.
Singleton pattern is used to create this Object.
There is one static block in this class.

Now my question is if n no. of beans create the object of this class in the
same JVM. Then its static block would be called only once.
Is this correct? Please let me know from your all good side.

And Im using this class to start one TimerTask thread to refresh my cache
after fixed amount of delay. Please comment on this design also.
Actually Bean is the entry point of my application so I cant start this. I
can call another helper class to start the thread but its more or less same.

So, plz give me your comments / help as its highly required.

Many Thanks.
regards,
Manish



Manish Malhotra
Patni Computer Systems Ltd
Vashi Infotech Park, Tower-1, Unit No.:141/151, 11P
Above Vashi Railway Station, Vashi
Navi Mumbai-400705, India
Tel: +91 22 55910849 Extn: 235
Fax:+91 22 55910855

===========================================================================
To unsubscribe, send email to listserv@(protected)
of the message "signoff J2EE-INTEREST". For general help, send email to
listserv@(protected)".

===========================================================================
To unsubscribe, send email to listserv@(protected)
of the message "signoff J2EE-INTEREST". For general help, send email to
listserv@(protected)".
©2008 junlu.com - Jax Systems, LLC, U.S.A.