Category: Java
Java
Introduction Here I am going to tell you how to insert and update a list of objects in batch using JDBC PreparedStatement in Java programming language. Generally when you have a list of objects or lots of data then probably it is not a good idea to insert or update individual record or object into…
Here in this tutorial we will discuss whether we should synchronize the run() method or not. Another question may arise can we synchronize run() method? In simple word, yes, we can synchronize the run() method. Do we need to synchronize the run method? When it comes to whether we need to synchronize or not, then…
Here I am showing a simple example on what is callback method in Java. A callback is a piece of code that you can pass as an argument to be executed on some other code. Since Java doesn’t yet support function pointer, the callback methods are implemented as command objects. A callback will usually hold…
Introduction In this tutorial I am going to show you how to create PDF file content with different formats using Java programming language. In this tutorial I am going to use iText library to generate the PDF document. Many applications require dynamic generation of PDF documents. The applications, where dynamically generated PDF is required, are…
What is busy waiting or spinning? Busy spinning or waiting in multi-threading environment is a technique in which a process repeatedly checks if a particular condition is true instead of wait() or sleep() method and without releasing the CPU. In other words busy spinning is one of the techniques to wait for events without releasing…
We will discuss about how to exchange data between two threads or a pair of threads. The Exchanger class under java.util.concurrent package was introduced in JDK 1.5 along with CyclicBarrier, CountDownLatch to exchange data between two threads only. A synchronization point at which two threads can pair and exchange data within pair using the exchange()…