|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This interface provides a means for implementing a thread allocator service.
A thread allocator service is used by the framework for controlling thread allocation
Runnable
,
Thread
Method Summary | |
java.lang.Thread |
obtainThread(java.lang.Object requestorId)
Allocates a new Thread object. |
java.lang.Thread |
obtainThread(java.lang.Object requestorId,
java.lang.Runnable target)
Allocates a new Thread object. |
java.lang.Thread |
obtainThread(java.lang.Object requestorId,
java.lang.Runnable target,
java.lang.String name)
Allocates a new Thread object. |
java.lang.Thread |
obtainThread(java.lang.Object requestorId,
java.lang.String name)
Allocates a new Thread object. |
java.lang.Thread |
obtainThread(java.lang.Object requestorId,
java.lang.ThreadGroup group,
java.lang.Runnable target)
Allocates a new Thread object. |
java.lang.Thread |
obtainThread(java.lang.Object requestorId,
java.lang.ThreadGroup group,
java.lang.Runnable target,
java.lang.String name)
Allocates a new Thread object with
requestorId as the requestor identifier,
target as its run object, the specified
name as its name; the thread is assigned to the thread group
referred to by group . |
java.lang.Thread |
obtainThread(java.lang.Object requestorId,
java.lang.ThreadGroup group,
java.lang.String name)
Allocates a new Thread object. |
Method Detail |
public java.lang.Thread obtainThread(java.lang.Object requestorId)
Thread
object. This method has
the same effect as obtainThread(requestorId, null, null,
gname)
, where gname is
an automatically generated name. Automatically generated names are of the
form "Thread-"+
n, where n is an integer.
Threads created this way must have overridden their
run
method to actually do anything. An example
illustrating this method being used follows:
class threadtest { public threadtest() { } public void initCmf(Framework cmf,ObjectName name){ Thread t1 = cmf.getThreadAllocatorSrvIf().obtainThread(name); if (t1 != null){ System.out.println("new Thread() succeed"); cmf.addObject(this, name); } else { System.out.println("new Thread() failed"); } }
resquestorId
- The requestor's identifierobtainThread(java.lang.Object, java.lang.ThreadGroup, java.lang.Runnable, java.lang.String)
public java.lang.Thread obtainThread(java.lang.Object requestorId, java.lang.Runnable target)
Thread
object. This method has
the same effect as obtainThread(requestorId, null, target,
gname)
, where gname is
an automatically generated name. Automatically generated names are of the
form "Thread-"+
n, where n is an integer.resquestorId
- The requestor's identifiertarget
- the object whose run
method is called.obtainThread(java.lang.Object, java.lang.ThreadGroup, java.lang.Runnable, java.lang.String)
public java.lang.Thread obtainThread(java.lang.Object requestorId, java.lang.ThreadGroup group, java.lang.Runnable target)
Thread
object. This method has
the same effect as obtainThread(requestorId, group, target,
gname)
, where gname is
an automatically generated name. Automatically generated names are of the
form "Thread-"+
n, where n is an integer.resquestorId
- The requestor's identifiergroup
- the thread group.target
- the object whose run
method is called.obtainThread(java.lang.Object, java.lang.ThreadGroup, java.lang.Runnable, java.lang.String)
public java.lang.Thread obtainThread(java.lang.Object requestorId, java.lang.String name)
Thread
object. This method has
the same effect as obtainThread(requestorId, null, null, name)
.resquestorId
- The requestor's identifiername
- the name of the new thread.obtainThread(java.lang.Object, java.lang.ThreadGroup, java.lang.Runnable, java.lang.String)
public java.lang.Thread obtainThread(java.lang.Object requestorId, java.lang.ThreadGroup group, java.lang.String name)
Thread
object. This method has
the same effect as obtainThread(requestorId, group, null, name)
resquestorId
- The requestor's identifiergroup
- the thread group.name
- the name of the new thread.obtainThread(java.lang.Object, java.lang.ThreadGroup, java.lang.Runnable, java.lang.String)
public java.lang.Thread obtainThread(java.lang.Object requestorId, java.lang.Runnable target, java.lang.String name)
Thread
object. This method has
the same effect as obtainThread(requestorId, null, target, name)
.resquestorId
- The requestor's identifiertarget
- the object whose run
method is called.name
- the name of the new thread.obtainThread(java.lang.Object, java.lang.ThreadGroup, java.lang.Runnable, java.lang.String)
public java.lang.Thread obtainThread(java.lang.Object requestorId, java.lang.ThreadGroup group, java.lang.Runnable target, java.lang.String name)
Thread
object with
requestorId
as the requestor identifier,
target
as its run object, the specified
name
as its name; the thread is assigned to the thread group
referred to by group
.
If group
is not null
, the
checkAccess
method of that thread group is called with
no arguments; this may result in throwing a
SecurityException
. If group
is
null
, the new process belongs to the same group as
the thread that is creating the new thread.
If the target
argument is not null
, the
run
method of the target
is called when
this thread is started. If the target argument is
null
, this thread's run
method is called
when this thread is started.
The priority of the newly created thread is set equal to the
priority of the thread creating it, that is, the currently running
thread. The method setPriority
may be used to
change the priority to a new value.
The newly created thread is initially marked as being a daemon
thread if and only if the thread creating it is currently marked
as a daemon thread. The method setDaemon
may be used
to change whether or not a thread is a daemon.
resquestorId
- The requestor's identifiergroup
- the thread group.target
- the object whose run
method is called.name
- the name of the new thread.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |