All Questions
Tagged with java concurrency
176 questions
4
votes
3
answers
665
views
Multithreaded array summation in Java - best practice, structure, acceptable use of Constant classes. There is no concurrency?
The task is educational. The basic functionality is working. Here are some questions for my code. Please give me feedback.
Main:
Architecture & Design: Is the decomposition appropriate? Should ...
1
vote
0
answers
51
views
Lock free Leaky Bucket Rate Limiter
I want to validate my solution for a lock-free leaky bucket rate limiter. Given a queuing capacity and rate limit per second, it should queue requests till capacity is reached and it should allow only ...
1
vote
2
answers
154
views
ProducerConsumerSimulation.java: practicing concurrent programming in Java
Intro
This time, I was in the mood for concurrent programing (ProducerConsumerSimulation.java). To this end, I have ended up with the code below. My primary concerns are:
Class design is trash,
The ...
2
votes
1
answer
88
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:
...
5
votes
2
answers
659
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.
...
3
votes
1
answer
144
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.
...
4
votes
1
answer
242
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 ...
5
votes
2
answers
918
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 ...
4
votes
2
answers
485
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 ...
2
votes
2
answers
162
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 ...
5
votes
2
answers
970
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 ...
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 ...
5
votes
3
answers
139
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.
...
2
votes
2
answers
154
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.
...
1
vote
1
answer
119
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 ...