1,433 questions
2
votes
1
answer
131
views
Does the JNI provide direct access to _Atomic values for the respective Java Atomic classes?
When working with JNI, can the native side obtain an _Atomic int32_t* given a Java AtomicInteger reference, and run C atomic functions on it (e.g. atomic_fetch_add)?
We could call Java's methods (e.g. ...
2
votes
1
answer
85
views
Can thread-unsafe combiner be used in Stream.collect method in java 8?
For a parallel Stream, the collect method has a 3-arg variant: (source: oracle documentation )
/**
Parameters:
supplier - a function that creates a new result container. For a parallel execution, this ...
2
votes
0
answers
106
views
Long term behavior of ScheduledExecutorService.scheduleAtFixedRate when tasks run too long
I'm using java.util.concurrent.ScheduledExcecutorService.scheduleAtFixedRate to execute a task periodically. I run it once every minute and it usually completes after 5 seconds, but occasionally runs ...
0
votes
1
answer
117
views
Concurrent & Thread issues
I have a multithreaded program that both produces output via a timer and receives user input. It behaves badly when I want to type in a command such as "pause" or "stop": anything ...
3
votes
1
answer
86
views
Can not reproduce experiment about RA mode of J9mm
I attempted to replicate the experiment about "Release/acquire" from Doug Lea‘s blog on j9mm (https://gee.cs.oswego.edu/dl/html/j9mm.html#summarysec) :
volatile int ready; // Initially 0, ...
0
votes
0
answers
33
views
modify java protobuf and protobuf extensions in parallel, version > 3.17
I have generated java protobuf class. This class has protobuf extensions also. Is it safe to modify different unrelated fields and extensions of the same protobuf builder in parallel?
message ...
4
votes
1
answer
210
views
thenCompose hangs/timeout web graphql application
Im trying to create a Java App using SpringBoot 3 framework and GraphQL. I'm trying to resolve a field which depends on several dataLoaders within my App however, I seem to be running into an issue ...
-1
votes
1
answer
57
views
Method Breaks After Implementing Focus Switching
I'm currently working on a concurrent implementation of multiplayer Tetris in JavaFX where each game is run on a separate Stage. Each game has its own set of inputs so you can play simultaneously as ...
0
votes
1
answer
74
views
Is there a way to switch the focus window upon a key press in JavaFX
Edit: I've cut down Mainboard to just the relevant function to make code shorter to read. If any additional code needs to be read to help understanding, please say
I'm currently making a multiplayer ...
0
votes
1
answer
102
views
Attach finally logic to CompletableFuture [duplicate]
I need to asynchronously consume future value and then run logic X. In case of any exceptions, I also want to execute logic X. In a way, it is semantically akin to the finally block.
I do not have a ...
-4
votes
1
answer
174
views
How to safely reset AtomicInteger value in highly multithreaded environment? [closed]
The class implementation below wraps two AtomicInteger fields. After the max=9999 value is reached, the main sequence number is expected to reset to zero. When the sequence number resets, the ...
1
vote
2
answers
109
views
Forking exception handling in Java CompletableStage
I have not used Java in a million years and trying to figure out how to differentiate between different types of Exception in CompleteableStage.
Currently, I have something like below but it does not ...
0
votes
3
answers
139
views
Spring 6.2 DefaultManagedTaskExecutor throws java.lang.UnsupportedOperationException: isShutdown when rejecting tasks
I have a problem regarding spring DefaultManagedTaskExecutor. We are deploying our SpringBoot 3.2.5 application to websphere Liberty and we are using Liberty ManagedExecutorService as external ...
2
votes
1
answer
516
views
Can't reproduce virtual thread pinning (jdk 21), yet mysql not as parallel as should be
The jdk 21 doc about virtual threads (hereafter "VT")
(https://docs.oracle.com/en/java/javase/21/core/virtual-threads.html)
is pretty clear about a synchronized block causing a thread to be ...
0
votes
1
answer
24
views
afterExecute method is not invoked defined in CustomThreadPoolExecutor that is passed to RabbitMQ Spring SimpleRabbitListenerContainerFactory
Spring-Rabbitmq SimpleRabbitListenerContainerFactory is defined with a CustomThreadPoolExecutor.
@Bean
public SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory(final ...