Skip to main content

Posts

Showing posts from February, 2024

Exchanger in Java's Concurrent API

The Exchanger class in Java's java.util.concurrent package offers a unique synchronization mechanism for concurrent programming. It facilitates exchange of objects between two threads in a pair , acting as a rendezvous point where both threads must arrive with their respective objects before any actual exchange occurs. Key Concepts: Object Exchange:  Each thread presents an object upon calling  exchange() . When both threads arrive, they exchange their objects and proceed. Synchronization:   exchange()  blocks the calling thread until its partner arrives, ensuring data consistency and preventing race conditions. Bidirectional Queue:  Consider  Exchanger  as a two-slot circular buffer where threads take and put items alternatively. Generic Type:  Accommodates exchange of objects of any type ( T ). Methods: exchange(T object) :  Exchanges the given object with another thread's and returns the received object. Blocks until another thread arriv...

Performance testing as part of shift-left approach

  Left-shift testing is a methodology that emphasizes moving testing activities earlier in the software development lifecycle (SDLC). Traditionally, testing happened mostly at the end, which led to delays and increased costs when issues were found. By shifting testing left, you identify and fix problems sooner, leading to a smoother development process and higher-quality software. Performance testing is a specific type of testing that focuses on measuring and evaluating the non-functional aspects of a system, such as speed, scalability, and responsiveness. This ensures the system can handle expected loads and deliver a good user experience. So, how do these two concepts connect? Shift-left testing is particularly valuable for performance testing because: Early detection:  Performing performance tests early in development catches issues before they become deeply integrated,  making them easier and cheaper to fix. Smaller codebase:  Testing smaller units of...