Java Reference
In-Depth Information
Constructs a new Thread with the specified name and uses the
run method of the specified target .
public Thread(ThreadGroup group, Runnable target)
Constructs a new Thread in the specified ThreadGroup and uses
the run method of the specified target . You will learn about
ThreadGroup later.
public Thread(ThreadGroup group, Runnable target, String name)
Constructs a new THRead in the specified THReadGroup with the
specified name and uses the run method of the specified target .
public THRead(ThreadGroup group, Runnable target, String name, long
stacksize)
Constructs a new THRead in the specified ThreadGroup with the
specified name and uses the run method of the specified tar-
get . The stackSize parameter allows a stack size for the thread
to be suggested. The values appropriate for a stack size are
completely system dependent and the system does not have
to honor the request. Such a facility is not needed by the vast
majority of applications, but like most things of this nature,
when you do need it, it is indispensable.
Classes that have only a run method are not very interesting. Real
classes define complete state and behavior, where having something
execute in a separate thread is only a part of their functionality. For ex-
ample, consider a print server that spools print requests to a printer.
Clients invoke the print method to submit print jobs. But all the print
method actually does is place the job in a queue and a separate thread
then pulls jobs from the queue and sends them to the printer. This al-
lows clients to submit print jobs without waiting for the actual printing
to take place.
 
Search WWH ::




Custom Search