Skip to content
Advertisement

Tag: concurrency

What is a usecase for Java AtomicReference#getAndSet?

What is a usecase for Java AtomicReference#getAndSet? In other words, is it correct assumption, that if the only method from AtomicReference that I use in my code is AtomicReference#getAndSet, then I do not need AtomicReference at all, just a volatile variable would be enough? For example, if I have the next code: , isn’t it always doing exactly the same

ForkJoinFramwork, call compute() directly without explicit ForkJoinPool/ExecutorService

Q: What happens when the compute() method, in a class “X” that extends RecursiveAction/Task, is directly called? Without calling a ForkJoinPool explicitly like the following: Instead a function call like the following still produce a similar result: What happens when the fork()/invokeAll() method inside class X is called (explicit ExecutorService is absent)? My assumption would be, when an fork() or

Advertisement