About 4,610,000 results
Open links in new tab
  1. java - What does 'synchronized' mean? - Stack Overflow

    Jul 6, 2009 · I have some questions regarding the usage and significance of the synchronized keyword. What is the significance of the synchronized keyword? When should methods be synchronized? …

  2. How does synchronized work in Java - Stack Overflow

    34 In Java, each Object provides the ability for a Thread to synchronize, or lock, on it. When a method is synchronized, the method uses its object instance as the lock. In your example, the methods bow …

  3. java - Como se usa el metodo synchronized de forma correcta - Stack ...

    Tengo que realizar un proyecto en el que se sincronicen 10 hilos, en el cual son hay 5 hilos de Ping y 5 hilos de Pong. Uno debe de imprimir "Ping", y otro "Pong" y lo deben de imprimir alternadame...

  4. java syntax: "synchronized (this)" - Stack Overflow

    It means that this block of code is synchronized meaning no more than one thread will be able to access the code inside that block. Also this means you can synchronize on the current instance (obtain lock …

  5. How to synchronize or lock upon variables in Java?

    Using the synchronized keyword on the methods will require threads to obtain a lock on the instance of sample. Thus, if any one thread is in newmsg(), no other thread will be able to get a lock on the …

  6. Java synchronized method lock on object, or method?

    In Java synchronization,if a thread want to enter into synchronized method/block, it will acquire the lock on: all synchronized non-static methods of this object

  7. Java Synchronized Block for .class - Stack Overflow

    The snippet synchronized(X.class) uses the class instance as a monitor. As there is only one class instance (the object representing the class metadata at runtime) one thread can be in this block.

  8. What is the use of static synchronized method in java?

    Nov 3, 2023 · I have read that static synchronized method locks in the class object and synchronized method locks the current instance of an object. So what's the meaning of locked on class object?

  9. Difference between volatile and synchronized in Java

    Aug 19, 2010 · The important semantic shared by locks a volatile variables is that they both provide Happens-Before edges (Java 1.5 and later). Entering a synchronized block, taking out a lock and …

  10. java - What is the difference between atomic / volatile / synchronized ...

    How do atomic / volatile / synchronized work internally? What is the difference between the following code blocks? Code 1 private int counter; public int getNextUniqueIndex() { return count...