setter « synchronize « 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 » synchronize » setter 

1. Java. How to properly synchronize getters and setters?    stackoverflow.com

If I have several mutable properties in an object that will be acted upon by several threads, I understand they should be synchronized.

class Doggie {
    private String name;
 ...

2. ReentrantLock synchronizing getters and setters    stackoverflow.com

Let's say you have the following code:

public int getSpeedX() {
    speedLock.lock();
    try {
        return speedX;
    ...

3. How can I synchronize getter while a setter is working in Java    stackoverflow.com

I am having a multi-thread application using a single static class which provied a list. I want getters of the static class to work freely (not syncronized against each other) but ...

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.