How do I create a thread?

Drigs

New Member
Joined
Aug 2, 2014
Messages
3
Reaction score
0
How do I ask a plumbing question or start a thread?
 
Since this is a tech forum :whistle:

Defining and Starting a Thread

An application that creates an instance of Thread must provide the code that will run in that thread. There are two ways to do this:

Provide a Runnable object. The Runnable interface defines a single method, run, meant to contain the code executed in the thread. The Runnable object is passed to the Thread constructor, as in the HelloRunnable example:

public class HelloRunnable implements Runnable {

public void run() {
System.out.println("Hello from a thread!");
}

public static void main(String args[]) {
(new Thread(new HelloRunnable())).start();
}

}
Subclass Thread. The Thread class itself implements Runnable, though its run method does nothing. An application can subclass Thread, providing its own implementation of run, as in the HelloThread example:

public class HelloThread extends Thread {

public void run() {
System.out.println("Hello from a thread!");
}

public static void main(String args[]) {
(new HelloThread()).start();
}

}
Notice that both examples invoke Thread.start in order to start the new thread.

Which of these idioms should you use? The first idiom, which employs a Runnable object, is more general, because the Runnable object can subclass a class other than Thread. The second idiom is easier to use in simple applications, but is limited by the fact that your task class must be a descendant of Thread. This lesson focuses on the first approach, which separates the Runnable task from the Thread object that executes the task. Not only is this approach more flexible, but it is applicable to the high-level thread management APIs covered later.

The Thread class defines a number of methods useful for thread management. These include static methods, which provide information about, or affect the status of, the thread invoking the method. The other methods are invoked from other threads involved in managing the thread and Thread object. We'll examine some of these methods in the following sections.

https://docs.oracle.com/javase/tutorial/essential/concurrency/runthread.html
 
If you replaced "How do I ask a plumbing question or start a thread?" with said plumbing question, you would have been good to go.
 
I have a Kwikot geyser and the safety valve gave up so it started leaking at the threads connecting to geyser. I got a new one but it was still leaking so I replaced that one and its also leaking. I heard so many plumbers tales and its actually funny. I figured out that the threads of the new valves are giving up and its plain at the point of contact. The old valve fits fine but its just not functioning so it leaks at the same spot when water heats up, but not when its cold like the new valves. What do I do to install a working valve?
 
I have a Kwikot geyser and the safety valve gave up so it started leaking at the threads connecting to geyser. I got a new one but it was still leaking so I replaced that one and its also leaking. I heard so many plumbers tales and its actually funny. I figured out that the threads of the new valves are giving up and its plain at the point of contact. The old valve fits fine but its just not functioning so it leaks at the same spot when water heats up, but not when its cold like the new valves. What do I do to install a working valve?

I know bugger all about geysers, but aren't safety valves supposed to leak? They release pressure inside to stop it from bursting?
 
I have a Kwikot geyser and the safety valve gave up so it started leaking at the threads connecting to geyser. I got a new one but it was still leaking so I replaced that one and its also leaking. I heard so many plumbers tales and its actually funny. I figured out that the threads of the new valves are giving up and its plain at the point of contact. The old valve fits fine but its just not functioning so it leaks at the same spot when water heats up, but not when its cold like the new valves. What do I do to install a working valve?

Did you use plumbers / thread seal / teflon tape?

This stuff:
Plumbers-Tape-Teflon-Wrapping-Pipe.jpg
 
Soooo, my Posting Permissions bottom right says i'm not allowed to post a new thread, or any attachements?

How do I change this status? Got a question / pic of a weird antenna I would like to have ID'ed...

Any advise maybe?
 
Soooo, my Posting Permissions bottom right says i'm not allowed to post a new thread, or any attachements?

How do I change this status? Got a question / pic of a weird antenna I would like to have ID'ed...

Any advise maybe?

I think after posting a few replies it'll automatically allow you to, guessing its to stop spammers from creating accounts and posting 'visit ww.xxxxxxxxxpornz.coms for free monies and $5000 a day working from home' or something
 
Soooo, my Posting Permissions bottom right says i'm not allowed to post a new thread, or any attachements?

How do I change this status? Got a question / pic of a weird antenna I would like to have ID'ed...

Any advise maybe?
You can go to the Off Topic sub-forum and start a thread there. You will have permission to post. :)
 
Top
Sign up to the MyBroadband newsletter
X