Tagged Questions
1
vote
6answers
54 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 ...
1
vote
0answers
41 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, ...
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 ...
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
70 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.
...
1
vote
2answers
69 views
Non-blocking method to start several threads and run a callabck on the parent thread when all children have finished
The main thing is that the callback should be on the PARENT thread and not called from the task, which is finishing the job (e.g. NOT like ThreadPoolExecutor's afterExecute() hook).
I'd like to have ...
0
votes
1answer
70 views
How to read data concurrently using java?
I have a method which takes a string as input and returns data from the DB based on the input string. I have an array of strings and I am currently passing each string as input and looping over the ...
1
vote
2answers
42 views
Reuse of a worker instance to handle several tasks
I have an application for web testing (based on Selenium but this should not matter much here) which executes quite a number of test cases successively. It takes a couple of hours to complete and the ...
2
votes
2answers
97 views
Will the use of volatile & atomic always ensures thread safety
I get mixed answer whenever I look for concurrent access , JCIP book I have already ordered and is on the way , but I want to nail this concurrency basics of mine , here is my scenario
I have 3 ...
1
vote
1answer
35 views
What is meant by cpu slack?
The following is an excerpt from the book Java Concurrency in Practice, Chapter 12.2 Testing for Performance where the author talks about throughput of a bounded buffer implementation.
Figure 12.1 ...
3
votes
1answer
84 views
Why not use a pseudo random number generator to produce test data?
From the book Java Concurrency in Practice , Chapter 12.1 Testing for correctness, specifically in sub-section 12.1.3 Testing safety(where the author wants to set up test cases for testing data-race ...
3
votes
3answers
74 views
Awaiting multiple instances of CountDownLatch in container
I wrote a class CountDownLatchContainer it has a await() method, that waits on all CountDownLatches. Everything is working fine.
public final class CountDownLatchContainer
{
private final ...
0
votes
1answer
41 views
Do i need to call Platform.runLater for updating UI if i'm working on JavaFX Application Thread
Do i need to create a new Runnable object and run Platform.runLater if i'm still working on JavaFX Application Thread for updating UI. For example, i need to update a Text object which is imported in ...
1
vote
3answers
135 views
Print RED BLUE GREEN in order using System.out.print
public class CyclicBar {
private final static CyclicBarrier cb = new CyclicBarrier(3,
new Runnable() {
@Override
public void run() {
...