Skip to main content

All Questions

Tagged with
2 votes
1 answer
79 views

Multithreaded Merge Sort Using ForkJoin Framework

I've implemented a multithreaded merge sort using Java's ForkJoin framework, and I wanted to gather feedback on its correctness, efficiency, and scalability. Here's my implementation: ...
Akash Gupta's user avatar
5 votes
2 answers
617 views

Thread-safe write-efficient register() method for a Load balancer

The code below was written for an interview question of designing a load balancer with only a register() method. ...
drets's user avatar
  • 313
3 votes
1 answer
123 views

Amount Transfer Between Different Accounts - Improved Version

This is an improved code version for Amount Transfer Between Different Accounts Welcoming any further improvements for this. ...
Jill's user avatar
  • 297
4 votes
1 answer
216 views

Amount Transfer Between Different Accounts

I implemented the below classes for transfer amount between different accounts. Used ConcurrentHashMap and Stamped Lock to handle concurrency. Am I missing any important concepts here? Are there any ...
Jill's user avatar
  • 297
6 votes
2 answers
876 views

Reduce String Length With Thread Safety & Concurrency

I implemented the below URL Shortener class. Used ConcurrentHashMap to handle concurrency. Short URL building logic may not be optimal, but it ensures that only ...
Jill's user avatar
  • 297
5 votes
2 answers
465 views

Implement service registry servers with load balancing strategies

Have Implemented below service registry class with 2 load balancing strategies.Used Strategy Pattern. Used Stamped lock ( Optimistic write locking) for ensuring thread safety and concurrency. Used ...
Jill's user avatar
  • 297
2 votes
2 answers
129 views

A thread-safe performant Money Transfer API in Java

This is a popular interview question. It is meant to be done within 30 minutes. The task is to implement a thread-safe performant Bank Account API that allows to transfer, deposit, withdraw and check ...
Sasha Shpota's user avatar
4 votes
2 answers
953 views

Simple load balancer

I would like to know the possible improvements in design and concurrency of the following load balancer: ability to add/register new instance keep max of 10 instances for load balancer forbid ...
tinyzero4's user avatar
7 votes
2 answers
1k views

A thread-safe performant URL Shortener in Java

This is a popular interview question. It is meant to be done within 45 minutes. The task is to implement a thread-safe performant in-memory URL Shortener. My implementation is based on two maps that ...
Sasha Shpota's user avatar
5 votes
3 answers
113 views

Time based cache for single element

The container should be thread safe and provide lazy load of data, and cache the data for set period of time. ...
trolkura's user avatar
  • 151
2 votes
2 answers
142 views

Multiple Producer and Multiple Consumer Implementation Using Locks and Semaphore

This solution has a total of four classes. Main.java: Class with main method. Execution starts here. ...
vvs14's user avatar
  • 121
0 votes
1 answer
105 views

decorator for an Executor that allows to get a List of running tasks

As stated in the javadoc below, this is intended for monitoring and debugging. I've found it especially useful for figuring out which tasks got stuck and prevented clean terminations of my ...
morgwai's user avatar
  • 379
0 votes
1 answer
69 views

Delayed, concurrent event stack in Java - follow-up

I have slightly refactored the Delayed, concurrent event stack in Java. Now it looks like this: DelayedEventStack.java ...
coderodde's user avatar
  • 30.2k
0 votes
3 answers
204 views

Delayed, concurrent event stack in Java

(See the next iteration: Delayed, concurrent event stack in Java - follow-up ) Motivation I was confronted with a task of having "message events" for a GUI program. The use case is as ...
coderodde's user avatar
  • 30.2k
3 votes
1 answer
157 views

A mutex that can detect certain types of programming error

This mutex prevents concurrent access to a target resource. One key requirement is the ability to be acquired in a (scheduler) thread and released in a different (worker) thread. Unfortunately this ...
Raffaele's user avatar
  • 131

15 30 50 per page
1
2 3 4 5
12