variable « concurrency « Java Thread Q&A

Home
Java Thread Q&A
1.concurrency
2.Development
3.Exception
4.Notify
5.Operation
6.Socket
7.State
8.synchronize
9.Thread Safe
10.ThreadPool
Java Thread Q&A » concurrency » variable 

1. Where is allocated variable reference, in stack or in the heap?    stackoverflow.com

Hi all members of stackoverflow, I have a question What happend when I declare a variable inside a method, for example.

void myMethod() {
    Ship myShip = new Ship();
}
Where is ...

2. What is the effect of final variable declaration in methods?    stackoverflow.com

Classic example of a simple server:

class ThreadPerTaskSocketServer {
   public static void main(String[] args) throws IOException {
      ServerSocket socket = new ServerSocket(80);
    ...

3. Implement a mutex in Java using atomic variables    stackoverflow.com

I want to implement a mutex in Java using atomic variables. I tried implementing it using lamport bakery algorithm and it works. But I am not sure how to implement it, ...

4. Concurrent read/write to a variable in java    stackoverflow.com

If I have a variable from which multiple threads read and only one thread writes, do I need to have a lock around that variable? Would it crash if one thread ...

7. Singleton Instance variables concurrency    forums.oracle.com

Thanks for the reminder about wrapping code with code tags. I read the article on JMM. When I look at my code, it appears to be correct since I use the synchronize key word everywhere the cacheObj is accessed. Both in getCacheObj() and refreshCache(). Can you enlighten me on what I might be missing. Thanks

8. About visibility of variables in concurrency    forums.oracle.com

Hi, I have a class that implements Runnable, and it has a constructor. As we know to ensure the change visibility of variables in different threads we need to use the "volatile" key word. So if I do not use "volatile," and contruct the object in the main thread, and then access and modify them in the run() method, could there ...

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.