Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
4 votes
2 answers
1k views

Distributed lock system using AWS S3

I need a distributed lock system for a service I'm writing. (There can be multiple instances of this service running at a time, and I need to make sure that only one instance does a particular cron ...
threed's user avatar
  • 181
2 votes
1 answer
207 views

Barging lock in Java

I found myself in need of a lock that allows my server to barge the write lock that might be acquired by my users. It would never interrupt them, but it would jump the line so the next time the write ...
corsiKa's user avatar
  • 660
1 vote
1 answer
456 views

Is this locked use of a Java HashMap thread safe?

I am trying to improve the performance of one of my project's methods, which obtains the command line of a process using WMI. A summary of key points: The method is on an object representing a Windows ...
Daniel Widdis's user avatar
2 votes
0 answers
118 views

Comparing Java Semaphore versus ReentrantReadWriteLock

In this post, I attempted to compare the performance of two concurrency constructs: java.util.concurrent.Semaphore, ...
coderodde's user avatar
  • 31.3k
3 votes
3 answers
1k views

Threadsafe Stack

Here is a class which I have written to create a simple Stack data structure which can be shared across multiple threads. It's a simple LIFO which has 2 operations: one to push onto the top of the ...
AbNig's user avatar
  • 141
5 votes
2 answers
4k views

Check for timeout in wait() loop

I want to check for a condition in a guarded wait() loop with a user-specified total timeout, similar to how ...
Mark Jeronimus's user avatar
1 vote
1 answer
2k views

Dining Philosopher's problem implementation with Java Locking Framework to avoid deadlock

Dining philosopher problem is one of the classic problems in computer science. I intended to implement it using Java threads. I attempted using the locking framework that came with Java 5 and used the ...
rokonoid's user avatar
  • 119
1 vote
1 answer
403 views

Acquiring multiple resource exclusively before processing using lock and monitor in JAVA

Here is my implementation of an all-or-wait-until-all kind of process. Each thread (kid) needs to guarantee it is the only thread processing the required resources (toys) at that moment. If some ...
user1589188's user avatar
3 votes
1 answer
146 views

Delete temp files on startup

I wrote some code for my question about deleting temp files that weren't deleted on exit before and would like to get some feedback if I forgot some details or got something wrong. ...
piegames's user avatar
  • 166
5 votes
1 answer
2k views

Concurrent byte array access in Java with different locking

I have one writer thread and 10 reader threads of a byte array. It is important to synchronize writes and reads over a "row" (16 bytes). There are a lot less locks than rows, e.g. in the current ...
Karussell's user avatar
  • 151
2 votes
1 answer
1k views

AutoCloseable Lock

Surprisingly, this question has no satisfactory answer. A safe usage of a LockCloseable would be like ...
maaartinus's user avatar
  • 13.6k
2 votes
1 answer
282 views

Thread-safe Bloom Filter in Java

I have tried to implement a Bloom Filter in Java here. https://github.com/srirammanoj/skynet/tree/master/bloomfilter I just wanted to know if my implementation can be called 'thread-safe' , and if ...
sriram manoj's user avatar
5 votes
2 answers
212 views

Lock implementation using atomics

I was recently given an interview and was asked to write my own lock implementation using atomics, but not necessary reentrant. I didn't answer the question, but at home, I wrote this code. Please ...
gstackoverflow's user avatar
3 votes
1 answer
106 views

ReadWriteMap implementation

I had a task to realize ReadWriteMap ...
gstackoverflow's user avatar
0 votes
2 answers
6k views

Simple Implementation of a ReentrantLock

An implementation of a ReentrantLock: ...
Thomas Mathew's user avatar

15 30 50 per page