We have been using Doug Lea's concurrent library for more than 8 years now. For backwards compatibility reasons our code was restricted to use Java 2 language level and JDK 1.3 ... |
I come from a Java background. I am wanting to learn more about concurrency in .Net and C#. Is there something similar to Java's concurrent utils package?
|
May I know is there any C++ equivalent class, to Java java.util.concurrent.ArrayBlockingQueue
http://download.java.net/jdk7/docs/api/java/util/concurrent/ArrayBlockingQueue.html
|
I have a need for a counter of type long with the following requirements/facts:
- Incrementing the counter should take as little time as possible.
- The counter will only be written to by one ...
|
I have a multithreaded app writing and reading a ConcurrentLinkedQueue, which is conceptually used to back entries in a list/table. I originally used a ConcurrentHashMap for this, which worked well. ... |
I'm scheduling a task using a ScheduledThreadPoolExecutor object. I use the following method:
public ScheduledFuture<?> schedule(Runnable command, long delay,TimeUnit unit)
and set the delay to 30 seconds (delay = 30,000 and ... |
For the sake of argument, let's say I'm implementing Future for a task which is not cancelable. The Java 6 API doc says:
After [cancel()] returns, subsequent ... |
|
We have a Scala server that is getting a node tree using Protocol Buffers over a socket and we need to attach additional data to each node.
In a single threaded context ... |
What does it mean, and more important how to avoid that?
My nio config is in the bottom
java.util.concurrent.RejectedExecutionException
at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:1760)
at org.jgroups.util.ShutdownRejectedExecutionHandler.rejectedExecution(ShutdownRejectedExecutionHandler.java:34)
at ...
|
I'm study java.util.concurrent library and find many infinite loops in the source code, like this one
//java.util.concurrent.atomic.AtomicInteger by Doug Lea
public final int getAndSet(int newValue) {
for (;;) {
...
|
I am trying to develop active object pattern in concurrent Java using java.util.concurrent classes.
I describe it using a Client and a Server. A sample Server is as:
class Server implements ...
|
my code throw follow exception:
java.util.ConcurrentModificationException
at java.util.LinkedList$ListItr.checkForComodification(LinkedList.java:761)
at java.util.LinkedList$ListItr.next(LinkedList.java:696)
at ...
|
Is there a Mutex object in java or a way to create one?
I am asking because a Semaphore object initialized with 1 permit does not help me.
Think of this case:
try {
...
|
From Memory Consistancy Property, we know that:
"Actions in a thread prior to placing an object into any concurrent collection happen-before actions subsequent to the access or removal of that ... |
What are the trade offs between using Java's built in concurency mechanism versus utilities (like ReentrantLocks for example) provided in java.util.concurrent
|
Can you spot the bug? This will throw an java.lang.OutOfMemoryError.
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class TestTheads {
public static void main(String[] args) {
...
|
Recently, I've been working on the deployment of concurrent objects onto multicore. In a sample, I use BlockingQueue.take() method whose specification mentions that it is blocking. It means that ... |
I looked into the code, everything is int -- the parameter passed to CountDownLatch constructor is int, the variable in Sync is int, the return type of Sync.getCount() is int. But ... |
I'm looking for an implementation of java.util.Set with the following features:
- Should be concurrent by no means of synchronized locking; So it's obvious that I don't want to use Collections.synchronizedSet().
- Should ...
|
I have a list of tasks submitted to an ExecutorService. But I need to shutdown the ExecutorService before a deadline of 2:30AM, even if the tasks are not finished. How can ... |
I am new to java.util.concurrent package. I'm trying to write some samples.
Here is my some sample code snippet:
for (MyTask task : tasks) {
Future<Boolean> result = task.getResult();
try {
...
|
I'm new to java.uti.concurrent package. I'm trying to develop a socket listner class by using ExecutorService. Here is my Main code snippet:
while (!getExit()) {
...
|
I have a task that I want to run at a fixed rate. However I also need the result of the task after each execution. Here is what I tried:
The task
class ...
|
If I submit task, and futureTask.get() returns null, I would like to process what I sent in the Callable object another way. When debugging, I can see that my Future ... |
could anyone tell me the logic behind java.util.concurrent.RecursiveTask? I couldn't find the source code either on a very cursory look, so maybe someone can point me to it as well? Thanks.
... |
Originally posted by Jim Yingst: I don't think I really understand your true goals here. That is, exact control of all aspects of the order such as you originally described is probably not practical or even possible, but partial control may be. You haven't explained your goals enough to say whether that will be acceptable. Why do you need to execute ... |
I've been trying to understand some of the new features of java.util.concurrent and I'm getting somewhat confused. I created a basic class to represent a bank account, with simple methods to check the balance and withdraw. I then wrote three test classes. Each class ran ten threads sharing a common account; each thread would check the balance and, if it was ... |
Hi Currently we're working on a standalone java engine to process billing for customers. The EA has decided to use Command pattern and a command factory which upon receiving messages is supposed to create a new command and submit it to an ExecutorService object to queue it, so it would be run by one of the worker threads in the pool. ... |
|
|
|
Hi, I am working on enhancing a project developed some time ago and none of the people that worked on it are there now! There is a package java.util.concurrent that is used, but the JRE 1.4 does not have it. I tried upgrading to JRE 6 but even then I get the same error saying that particular package (and associated classes ... |
|
I am sure you have considered the following arguments already, I'll list them anyway: Synchronization concerns some form of locking and acquiring more than one lock is error prone (when less than genious-type devs are involved), it's therefore wise to avoid acquiring a lock if unecessary and thus reduce chances of deadlocks and other bugs. This is probably the reasoning for ... |