In this story I will go through the concept of Distribution Patterns, Data Transfer Object and Remote Facade.
I’m pretty sure you already heard about DTO (also called value objects) and created at least one DTO class in your software dev career.
When you’re working with a remote interface (e.g., web services), each call to it is expensive. As a result you need to reduce the number of calls, and that means that you should use DTO that aggregates the data to transfer more data with each call.
Data Transfer Object should not contain any business logic and it needs to be serializable to go across the connection. Usually an assembler also called mapper is used for data transfer between domain objects and DTO objects. …
In this story we are going to see what is memory leak, garbage collector, examples of leaks in Java and tools to detect leaks.
One of the key benefits of Java is that memory management is mainly handled by Java Virtual Machine or more specific Java Garbage Collector (GC). Java Garbage Collector is responsible for allocation and deallocation of objects on Heap.
In computer science, memory leak means that computer programs incorrectly manage memory allocation by not releasing resources that are not needed. In Java, Memory Leak occurs when an object is no longer being used by an application, but Garbage Collector is not able to remove it from working memory (Heap). …
In this post we are going to see examples of thread joining, thread synchronization using object’s wait, notify and notifyAll methods and what is ThreadLocal and how to use it.
If you are more interested in Race Condition and Deadlock situations, take a look at my previous post (Threads in Java).
The join() method puts the calling thread into a waiting state until the referenced thread terminates. It means that the join() method makes one thread wait until another thread completes its execution. If any thread calls an interrupt of the referenced thread,
InterruptException exception will be thrown.
Waits forever for the thread to die. …