Because it needs to hold the lock on the class itself, not on a object. A
book you can reference: Java Thread Programming.
-----Original Message-----
From: Milt Epstein [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 05, 2000 1:10 PM
To: [EMAIL PROTECTED]
Subject: Re: Synchronize method in the servlet
On Thu, 5 Oct 2000, Wang, Jianming wrote:
> The performance issue is mainly caused by "synchronized" on *static*
> method.
Why is synchronize on a static method so much worse than on a regular
method?
> -----Original Message-----
> From: Tiana Zhang [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, October 05, 2000 12:39 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Synchronize method in the servlet
>
>
> I realized that. But all my method doing is to do the database
access(insert
> and
> update) which need to be protected. In this case, Do you think the
> performance
> will be the same for 'sync' either the block or the method?
>
> Thanks,
>
> Tiana
>
> -----Original Message-----
> synchronize on static method will lower performance significantly.
Instead,
> you
> can synchronize a block inside the method.
>
>
___________________________________________________________________________
> 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
>
Milt Epstein
Research Programmer
Software/Systems Development Group
Computing and Communications Services Office (CCSO)
University of Illinois at Urbana-Champaign (UIUC)
[EMAIL PROTECTED]
___________________________________________________________________________
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