Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-14-2007, 10:49 PM
Member
 
Join Date: Nov 2007
Posts: 1
mikeg1z is on a distinguished road
Local Variables for a static method - thread safe?
Are they?

Is the exact memory location used for a local variable?
The method is indeed static so it's in the same memory location, I assume, but are the local variables as well? If they are placed on the stack then there is a different copy for every calling thread.

Does anybody knows for sure?

Thanks,
-Michael
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-16-2007, 02:06 AM
Member
 
Join Date: Aug 2007
Posts: 47
henry_78 is on a distinguished road
Hi,
To say if u variable is thread safe or not, it has to be a globale varaible(a class variable).
When a variable is decleared in a method, if gets distroied when the method execution is terminated..it dosent matter if its static or not, the fact is its a locale variable.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
The safe way to stop a thread Java Tip java.lang 0 04-09-2008 07:31 PM
Struts framework. Is this thread safe? JavaAl2 Web Frameworks 1 01-17-2008 04:01 AM
is synchronization on method passing local variables as parameters needed reddzer Java Servlet 0 11-10-2007 05:47 PM
Are Local variables thread safe ? samson Threads and Synchronization 3 08-09-2007 07:59 PM
Error: Non-static method append(char) cannot be referenced from a static context paul Advanced Java 1 08-07-2007 06:05 AM


All times are GMT +3. The time now is 08:09 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org