tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brandon Cruz" <>
Subject RE: Java Question
Date Wed, 13 Jun 2001 14:16:15 GMT
Thank you everyone for your help!  It has been VERY helpful to see
everyone's opinion and share knowledge on the topic of static methods and
synchronization.  I think many people have learned alot from this thread.  I
understand it was off topic, but sometimes the best way to get an answer is
to ask the community of JAVA DEVELOPERS you are familiar with.  Kind of like
asking a question of someone at work who will know the answer, but is not
working on your specific project.  Jan, I'm sure I offended you by starting
this thread, just like the ten other people you have so scolded in the past
week.  I'm sorry!

Thanks again for everyone's help!


-----Original Message-----
From: Hemant Singh []
Sent: Tuesday, June 12, 2001 11:22 PM
Subject: Re: Java Question

HI Bran:
There is no relation betn static and synchronize

If you are synchronizing the static method than it
does means you are giving him the class level lock,
and not instance level lock.
Hope that help

--- Brandon Cruz <> wrote:
> I have looked all over and can't find the answer to
> this simple question.
> If you use a static method, do you have to
> synchronize it in case other
> people may access it at the same time.  For example,
> I have a static Utility
> class to do date calculations.  The method
> Utility.getMonth(String date)
> takes in a full date string, parses it, and returns
> just the month value.
> If 5 different people all using the website attempt
> to use
> Utility.getMonth(String date) at the same time for
> different dates, will it
> return the right results?  If not, do I have to
> synchronize it or something
> in case multiple users attempt to access it?
> I know this is not really related to tomcat, but
> since I am using tomcat,
> and everyone else using tomcat is also a java
> developer, I figured this is
> the best place I can ask.
> Thanks for any help!!!
> Brandon

Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year!

View raw message