A thread is allowed to access information about its own thread group, but not to access information about its thread group's parent thread group or any other thread groups.
The checkAccess
method of the parent thread group is
called with no arguments; this may result in a security exception.
The checkAccess
method of the parent thread group is
called with no arguments; this may result in a security exception.
Due to the inherently imprecise nature of the result, it is recommended that this method only be used for informational purposes.
Due to the inherently imprecise nature of the result, it is recommended that this method only be used for informational purposes.
If there is a security manager, its checkAccess
method
is called with this thread group as its argument. This may result
in throwing a SecurityException
.
First, the checkAccess
method of this thread group is
called with no arguments; this may result in a security exception.
First, the checkAccess
method of this thread group is
called with no arguments; this may result in a security exception.
An application might use the activeCount
method to
get an estimate of how big the array should be, however if the
array is too short to hold all the threads, the extra threads are
silently ignored. If it is critical to obtain every active
thread in this thread group and its subgroups, the caller should
verify that the returned int value is strictly less than the length
of list.
Due to the inherent race condition in this method, it is recommended that the method only be used for informational purposes.
recurse
flag is
true
, references to every active thread in this
thread's subgroups are also included. If the array is too short to
hold all the threads, the extra threads are silently ignored.
First, the checkAccess
method of this thread group is
called with no arguments; this may result in a security exception.
An application might use the activeCount
method to
get an estimate of how big the array should be, however if the
array is too short to hold all the threads, the extra threads are
silently ignored. If it is critical to obtain every active thread
in this thread group, the caller should verify that the returned int
value is strictly less than the length of list.
Due to the inherent race condition in this method, it is recommended that the method only be used for informational purposes.
First, the checkAccess
method of this thread group is
called with no arguments; this may result in a security exception.
An application might use the activeGroupCount
method to
get an estimate of how big the array should be, however if the
array is too short to hold all the thread groups, the extra thread
groups are silently ignored. If it is critical to obtain every
active subgroup in this thread group, the caller should verify that
the returned int value is strictly less than the length of
list.
Due to the inherent race condition in this method, it is recommended that the method only be used for informational purposes.
recurse
flag is
true
, references to all active subgroups of the
subgroups and so forth are also included.
First, the checkAccess
method of this thread group is
called with no arguments; this may result in a security exception.
An application might use the activeGroupCount
method to
get an estimate of how big the array should be, however if the
array is too short to hold all the thread groups, the extra thread
groups are silently ignored. If it is critical to obtain every
active subgroup in this thread group, the caller should verify that
the returned int value is strictly less than the length of
list.
Due to the inherent race condition in this method, it is recommended that the method only be used for informational purposes.
The equals
method implements an equivalence relation
on non-null object references:
x
, x.equals(x)
should return
true
.
x
and y
, x.equals(y)
should return true
if and only if
y.equals(x)
returns true
.
x
, y
, and z
, if
x.equals(y)
returns true
and
y.equals(z)
returns true
, then
x.equals(z)
should return true
.
x
and y
, multiple invocations of
x.equals(y) consistently return true
or consistently return false
, provided no
information used in equals
comparisons on the
objects is modified.
x
,
x.equals(null)
should return false
.
The equals method for class Object
implements
the most discriminating possible equivalence relation on objects;
that is, for any non-null reference values x
and
y
, this method returns true
if and only
if x
and y
refer to the same object
(x == y
has the value true
).
Note that it is generally necessary to override the hashCode method whenever this method is overridden, so as to maintain the general contract for the hashCode method, which states that equal objects must have equal hash codes.
First, if the parent is not null
, the
checkAccess
method of the parent thread group is
called with no arguments; this may result in a security exception.
java.util.Hashtable
.
The general contract of hashCode
is:
hashCode
method on each of
the two objects must produce the same integer result.
As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the JavaTM programming language.)
First, the checkAccess
method of this thread group is
called with no arguments; this may result in a security exception.
This method then calls the interrupt
method on all the
threads in this thread group and in all of its subgroups.
wait
methods.
The awakened thread will not be able to proceed until the current thread relinquishes the lock on this object. The awakened thread will compete in the usual manner with any other threads that might be actively competing to synchronize on this object; for example, the awakened thread enjoys no reliable privilege or disadvantage in being the next thread to lock this object.
This method should only be called by a thread that is the owner of this object's monitor. A thread becomes the owner of the object's monitor in one of three ways:
synchronized
statement
that synchronizes on the object.
Class,
by executing a
synchronized static method of that class.
Only one thread at a time can own an object's monitor.
wait
methods.
The awakened threads will not be able to proceed until the current thread relinquishes the lock on this object. The awakened threads will compete in the usual manner with any other threads that might be actively competing to synchronize on this object; for example, the awakened threads enjoy no reliable privilege or disadvantage in being the next thread to lock this object.
This method should only be called by a thread that is the owner
of this object's monitor. See the notify
method for a
description of the ways in which a thread can become the owner of
a monitor.
First, the checkAccess
method of this thread group is
called with no arguments; this may result in a security exception.
This method then calls the resume
method on all the
threads in this thread group and in all of its sub groups.
First, the checkAccess
method of this thread group is
called with no arguments; this may result in a security exception.
A daemon thread group is automatically destroyed when its last thread is stopped or its last thread group is destroyed.
First, the checkAccess
method of this thread group is
called with no arguments; this may result in a security exception.
If the pri
argument is less than
Thread#MIN_PRIORITY
or greater than
Thread#MAX_PRIORITY
, the maximum priority of the group
remains unchanged.
Otherwise, the priority of this ThreadGroup object is set to the
smaller of the specified pri
and the maximum permitted
priority of the parent of this thread group. (If this thread group
is the system thread group, which has no parent, then its maximum
priority is simply set to pri
.) Then this method is
called recursively, with pri
as its argument, for
every thread group that belongs to this thread group.
First, the checkAccess
method of this thread group is
called with no arguments; this may result in a security exception.
This method then calls the stop
method on all the
threads in this thread group and in all of its subgroups.
First, the checkAccess
method of this thread group is
called with no arguments; this may result in a security exception.
This method then calls the suspend
method on all the
threads in this thread group and in all of its subgroups.
Any exception thrown by this method will be ignored by the Java Virtual Machine.
The current thread must own this object's monitor. The thread
releases ownership of this monitor and waits until another thread
notifies threads waiting on this object's monitor to wake up
either through a call to the notify
method or the
notifyAll
method. The thread then waits until it can
re-obtain ownership of the monitor and resumes execution.
As in the one argument version, interrupts and spurious wakeups are possible, and this method should always be used in a loop:
synchronized (obj) { while (<condition does not hold>) obj.wait(); ... // Perform action appropriate to condition }This method should only be called by a thread that is the owner of this object's monitor. See the
notify
method for a
description of the ways in which a thread can become the owner of
a monitor.The current thread must own this object's monitor.
This method causes the current thread (call it T) to place itself in the wait set for this object and then to relinquish any and all synchronization claims on this object. Thread T becomes disabled for thread scheduling purposes and lies dormant until one of four things happens:
A thread can also wake up without being notified, interrupted, or timing out, a so-called spurious wakeup. While this will rarely occur in practice, applications must guard against it by testing for the condition that should have caused the thread to be awakened, and continuing to wait if the condition is not satisfied. In other words, waits should always occur in loops, like this one:
synchronized (obj) { while (<condition does not hold>) obj.wait(timeout); ... // Perform action appropriate to condition }(For more information on this topic, see Section 3.2.3 in Doug Lea's "Concurrent Programming in Java (Second Edition)" (Addison-Wesley, 2000), or Item 50 in Joshua Bloch's "Effective Java Programming Language Guide" (Addison-Wesley, 2001).
If the current thread is interrupted by another thread while it is waiting, then an InterruptedException is thrown. This exception is not thrown until the lock status of this object has been restored as described above.
Note that the wait method, as it places the current thread into the wait set for this object, unlocks only this object; any other objects on which the current thread may be synchronized remain locked while the thread waits.
This method should only be called by a thread that is the owner
of this object's monitor. See the notify
method for a
description of the ways in which a thread can become the owner of
a monitor.
This method is similar to the wait
method of one
argument, but it allows finer control over the amount of time to
wait for a notification before giving up. The amount of real time,
measured in nanoseconds, is given by:
1000000*timeout+nanos
In all other respects, this method does the same thing as the method of one argument. In particular, wait(0, 0) means the same thing as wait(0).
The current thread must own this object's monitor. The thread releases ownership of this monitor and waits until either of the following two conditions has occurred:
notify
method
or the notifyAll
method.
timeout
milliseconds plus nanos
nanoseconds arguments, has
elapsed.
The thread then waits until it can re-obtain ownership of the monitor and resumes execution.
As in the one argument version, interrupts and spurious wakeups are possible, and this method should always be used in a loop:
synchronized (obj) { while (<condition does not hold>) obj.wait(timeout, nanos); ... // Perform action appropriate to condition }This method should only be called by a thread that is the owner of this object's monitor. See the
notify
method for a
description of the ways in which a thread can become the owner of
a monitor.