java-threads Questions
3
Solved
If I want to run a Stream in parallel in a background task is it possible to run it in lower priority? And if so how?
Coucher asked 26/11, 2017 at 3:44
3
Solved
I'm making a desktop application in java and am doing some memory optimisations. That made me come across two threads running in the JVM, both named:
RMI TCP connection
And they're both contribut...
Hilmahilt asked 24/11, 2016 at 19:41
6
How I can call a particular thread in inter-thread communication?
In the program below I have two threads t1 and t2.
When I call t1.notify() it raises:
Exception in thread "Thread-1" java.lang.I...
Scapular asked 8/4, 2017 at 2:2
1
Solved
I am study wait(long timeout) in java,and in the offcial document I found below description:
Some other thread invokes the notify method for this object and thread T happens to be arbitrarily cho...
Malvina asked 7/9, 2022 at 11:29
4
Solved
I was going through Java Concurrency In Practice and got stuck at the 8.3.1 Thread creation and teardown topic. The following footnote warns about keeping corePoolSize to zero.
Developers are so...
Permissive asked 10/9, 2018 at 7:42
42
Solved
From what time I've spent with threads in Java, I've found these two ways to write threads:
With implements Runnable:
public class MyRunnable implements Runnable {
public void run() {
//Code
}
}...
Mckinley asked 12/2, 2009 at 14:28
6
Solved
I am just learning Threads in Java and I want to sort a list of words alphabetical. My program read the words of a txt-file and put them in a String-array. The user can choose how many threads they...
Gordan asked 18/4, 2016 at 8:28
2
Solved
When profiling my application I came across a weird behavior - the DestroyJavaVM thread is ALWAYS running - 100% of the time.
After doing a little research on the subject, on which there's hardly...
Hime asked 23/12, 2015 at 10:12
4
Solved
There seems to be a discrepancy between SO consensus and nearly every Java thread state diagram on the Internet; specifically, regarding thread state transition from WAITING after notify() or notif...
Rheinlander asked 7/2, 2015 at 4:36
9
Solved
I am using an ExecutoreService in Java 1.6, started simply by
ExecutorService pool = Executors.newFixedThreadPool(THREADS).
When my main thread is finished (along with all the tasks processed ...
Boudreaux asked 14/12, 2012 at 17:13
3
Solved
This is the code to find the first pair of numbers (except 1) whose sum of LCM and HCF is equal to the number.
import java.util.*;
import java.util.concurrent.atomic.AtomicLong;
class PerfectParti...
Ironist asked 5/2, 2021 at 5:15
2
Solved
I am trying to parallelize the multiplication of two matrix A,B.
Unfortunately the serial implementation is still faster than the parallel one or the speedup is too low. (with matrix dimension = 51...
Clairclairaudience asked 25/11, 2020 at 14:54
5
I have not worked in multithreading, what is the difference between join and wait ,notify method ? is the difference only limited to obtain lock and refrain other threads from accessing it or are t...
Gelatin asked 9/5, 2017 at 10:36
4
I have an application which has a remote service running in a separate process:
<service android:name=".MyService" android:process=":remote"/>
I'm also using an Applicati...
Niobium asked 5/8, 2011 at 9:16
1
In the below example, as the main-thread is not getting notified from the child thread, it should wait forever. But the main-thread is getting executed and the output of the below example is:
c
l
t...
Beluga asked 16/8, 2020 at 2:32
1
Solved
I'm debugging a multi-threaded Java application in IntelliJ. I want to suspend all threads on some breakpoint and resume only selected thread while I step-over the code. I can suspend all threads o...
Savaii asked 23/5, 2020 at 3:32
33
Solved
What is the difference between a wait() and sleep() in Threads?
Is my understanding that a wait()-ing Thread is still in running mode and uses CPU cycles but a sleep()-ing does not consume any CPU ...
Edie asked 24/6, 2009 at 6:48
1
Solved
Having following scratch code:
public static void main(String[] args) throws ExecutionException, InterruptedException {
CompletableFuture<Void> process1 = CompletableFuture.runAsync(() -&...
Dumpling asked 10/2, 2020 at 13:30
5
Solved
I have a queue of running threads and would like to expose some of its data while it is executed, to monitor the process.
ThreadPoolExecutor provides access to its queue and I can iterate through ...
Aggregation asked 23/2, 2016 at 7:34
12
If I synchronized two methods on the same class, can they run simultaneously on the same object? For example:
class A {
public synchronized void methodA() {
//method A
}
public synchronized vo...
Calamint asked 15/3, 2013 at 17:35
3
Solved
If we are in a situation with two running threads on a machine with two processors and we call Thread.yield() within one of those threads, does it stand to reason that nothing will happen (the sche...
Apfelstadt asked 8/5, 2019 at 15:15
2
Solved
I started to do research to find out why the word "join" is used for the Thread.join() method. In fact, it waits for the thread to end on which it is called and pauses the main thread to wait for i...
Hoag asked 1/1, 2019 at 21:53
2
I'm using log4j2 for logging, tomcat8 and java8 version.
I used attribute "monitorInterval" to periodically check my log4j2.xml.
During shutdown my tomcat i'm facing issue of memory leak.How to res...
Bikol asked 6/10, 2016 at 17:59
2
Suppose we have a list and want to pick all the elements satisfying a property(let say some functions f). There are 3 ways to parallel this process.
One :
listA.parallelStream.filter(element -> ...
Philomena asked 12/9, 2018 at 3:37
1
Solved
I am here asking about closing a kafka consumer. Do I need to close kafka consumer even if the using thread exits? Would not closing it leak resources by any change?
Here is a code example:
pub...
Enquire asked 16/8, 2018 at 10:47
1 Next >
© 2022 - 2024 — McMap. All rights reserved.