Java package which contains utility classes commonly useful in concurrent programming. This package includes a few small standardized extensible frameworks, as well as some classes that provide useful functionality and are otherwise tedious or difficult to implement.

learn more… | top users | synonyms

0
votes
0answers
7 views

Java compareAndSet to atomically update references in a BST

In a binary tree, I'm trying to atomically replace left child of parent to a new node. In the below method, pnode.left is pointing to node and I'm trying to change it to replaceNode. In line1, ...
1
vote
6answers
47 views

Java threading and outputstream printinng issue

Hi I am just trying my hands with threading, Just a Request its not a homework or anything its just testing of my understanding of the subject, so those who doesnt like it please dont close it there ...
0
votes
0answers
2 views

future.get after ScheduledThreadPoolExecutor shutdown, will it work?

We use the ScheduledThreadPoolExecutor and after submitting the job we call shutdown immediately. Because as per doc Shutdown does not kill the submitted task, running task and allows it to complete. ...
1
vote
0answers
38 views

Resettable timer performance in Java

When profiling my app, I found a source of frequent allocations... I have multiple timers that that check for timeouts (~2ms, varies with app state). According to this SO answer, ...
2
votes
2answers
43 views

List ConcurrentModificationException

I have the following code public void saveProjects(List<Project> proj) throws DatabaseException { for (Project listItems: proj) { // error here insertProjects(listItems); } } ...
0
votes
1answer
47 views

multithreading to calculate primes java

I am trying to parallelize a prime number counter as an exercise. I have refactored the original code and separated the long loops from others so that I can parallelize them. Now I have the following ...
0
votes
0answers
26 views

Reader-writer visibility in Java LinkedBlockingQueue

I have confusion about JDK6+ LinkedBlockingQueue reader-writer visibility implementations. Source codes in JDK 1.6.45: static class Node<E> { E item; Node<E> next; Node(E x) ...
1
vote
1answer
26 views

Perform a task 'n' times in parallel

I am trying to figure out the easiest way to invoke a task 'x' times and all in parallel in java. The task has a string variable whose value should be unique for each invocation and it returns a ...
0
votes
0answers
14 views

Java Monitors — Catching InterruptedException

I have a java implementation of a monitor using java.util.concurrent.locks.Lock; java.util.concurrent.locks.ReentrantLock; java.util.concurrent.locks.Condition; The problem that I'm solving is a ...
0
votes
0answers
12 views

AtomicInteger get() vs incrementAndGet()

Why AtomicInteger.get() brings different results after the call to incrementAndGet() ? I have the following small tutorial code: @Component public class AsyncWorker implements Worker { public ...
0
votes
2answers
65 views

How to concurrently modify a Vector

I have to ensure while iterating the Vector; there is no update on that Vector to avoid ConcurrentModificationException. I can use concurrent collection. But i just want to give a try on Vector. Below ...
4
votes
2answers
86 views

Why there is no AtomicBooleanArray datatype in Java?

I have noticed that there is NO AtomicBooleanArray datatype in Java similar to the AtomicIntegerArray. Although I can use AtomicBoolean[] for my current needs, I was curious to get an understanding ...
1
vote
0answers
18 views

Working with Executors and Handlers within a Android Service

First of all: I am a multi-threading newbie. So forgive my stupidity on this matter :) I want to accomplish the following: Startup an Android Service and initialize/start several threads next to ...
0
votes
4answers
81 views

If I simply need to guarantee `happens-before` relation, and not atomicity, should I use a concurrent class or a synchronized block?

I am developing a pool mechanism. Objects in the pool will be used by different threads. Thus I need to guarantee that there will be a happens-before relation when accessing non-final attributes of ...
5
votes
3answers
69 views

Concurrent request processing in Java with constraints

Suppose I need to process requests of 3 types: A, B, and C as follows: Requests are processed concurrently. There are at most K (<= 3) requests to be processed concurrently at the same time. ...

15 30 50 per page