Meet Patel

I am a passionate programmer, blogger, and developer by choice. I like to write and contribute to the developer community.

Thread Synchronization using Synchronized Block in Java : Free Java Tutorials

Synchronized Block is an alternate way to perform thread synchronization in Java. It reduces unnecessary overhead as it makes only a portion of a method synchronized instead of making the entire method synchronized. If only a few lines of the code require synchronization, then it is not feasible to declare an entire method as synchronized …

Thread Synchronization using Synchronized Block in Java : Free Java Tutorials Read More »

Object vs Class Level Locks for Thread Synchronization in Java : Free Java Tutorials

There exist two types of locks in Java to carry out thread synchronization. They are object level lock and class level lock. These two locks are always there for each class as well as each object in java to support thread synchronization. Object level vs Class level locks in thread synchronization In thread synchronization, there …

Object vs Class Level Locks for Thread Synchronization in Java : Free Java Tutorials Read More »

Thread Synchronization and Locking Mechanism in Java : Free Java Tutorials

Thread Synchronization is done in Java using the synchronized keyword which uses locking mechanism to synchronize threads in a multi-threaded environment. Synchronized is the modifier applicable to methods and blocks. It is not applicable to variables and classes. If multiple threads are trying to operate on the same java object simultaneously, then there is a …

Thread Synchronization and Locking Mechanism in Java : Free Java Tutorials Read More »

Thread Synchronization Practices in Java : Free Java Tutorials

We must follow some practices and rules while performing thread synchronization in Java. Every Java object has synchronized as well as non-synchronized area. The non-synchronized portion of an object can be accessed by multiple threads simultaneously. Whereas, the synchronized area can be accessed by only one thread at a time. Whenever we perform any update operation …

Thread Synchronization Practices in Java : Free Java Tutorials Read More »

Thread Prevention using sleep Method in Java : Free Java Tutorials

Thread Prevention can also be done using sleep method. If a thread does not want to perform any operation for a specific amount of time, then we should go for sleep method. Sleep method causes thread execution to pause for the specified period of time. We will understand in detail about sleep method in this …

Thread Prevention using sleep Method in Java : Free Java Tutorials Read More »