|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
public class Object
Object is the base class for all classes in Java.
Constructor Summary | |
---|---|
Object()
|
Method Summary | |
---|---|
protected Object |
clone()
clone creates a shallow clone of this. |
boolean |
equals(Object other)
equals compares this object to another object. |
protected void |
finalize()
finalize may be called by the memory management of the virtual machine when it determined that this instance's memory is unreachable and can be reclaimed. |
Class<?> |
getClass()
getClass obtains a reference to the class associated with this object. |
int |
hashCode()
hashCode returns a hash code for this object. |
void |
notify()
notify wakes up one thread of the set of threads wait()ing for this object's monitor. |
void |
notifyAll()
notifyAll wakes up all threads of the set of threads wait()ing for this object's monitor. |
String |
toString()
toString creates a printable string that represents this object for debugging purposes. |
void |
wait()
wait causes this thread to block until one of the following events happened: |
void |
wait(long timeout)
wait causes this thread to block until one of the following events happened: |
void |
wait(long timeout,
int nanos)
wait causes this thread to block until one of the following events happened: |
Constructor Detail |
---|
public Object()
Method Detail |
---|
public final Class<?> getClass()
public int hashCode()
The default implementation returns System.identityHashCode(this).
public final void notify()
For JamaicaVM: The thread that wait()ed for notification longest will be woken up first.
IllegalMonitorStateException
- if the current thread did
not enter this object's monitor.public final void notifyAll()
For JamaicaVM: The thread that wait()ed for notification longest will be woken up first.
IllegalMonitorStateException
- if the current thread did
not enter this object's monitor.public boolean equals(Object other)
Equals must be symmetric (a.equals(b) == b.equals(a)), reflexive (a.equals(a)==true) and transitive (a.equals(b) && b.equals(c) IMPLIES (a.equals(c))) and not change over time (a.equals(b) == a.equals(b)). a.equals(null) should always return false.
If a.equals(b) is true for two objects a and b, then a.hashCode()==b.hashCode() must hold.
The default implementation of equals returns this==other.
other
- the other object.
protected Object clone() throws CloneNotSupportedException
CloneNotSupportedException
- if this does not implement the
Cloneable interface, OutOfMemoryError if we run out of memory.public String toString()
The default implementation returns getClass().getName() + '@' + Integer.toHexString(hashCode()).
public final void wait(long timeout, int nanos) throws InterruptedException
- Another thread called notify on this object, the current
thread is the highest priority thread in the waiting queue and no other thread owns this monitor (i.e., the notifying thread leaves this monitor).
- Another thread called notifyAll on this object and no other
thread owns this monitor (i.e., the notifying thread leaves this monitor).
- Another thread calls Thread.interrupt() on this thread.
- the specified timeout/nanos is not 0 and is expired.
timeout
- timeout in milliseconds.nanos
- timeout in nanoseconds.
IllegalArgumentException
- if timeout<0, nanos<0 or
nanos>999999.
InterruptedException
- if another thread called
Thread.interrupt() on this thread.public final void wait(long timeout) throws InterruptedException
- Another thread called notify on this object, the current
thread is the highest priority thread in the waiting queue and no other thread owns this monitor (i.e., the notifying thread leaves this monitor).
- Another thread called notifyAll on this object and no other
thread owns this monitor (i.e., the notifying thread leaves this monitor).
- Another thread calls Thread.interrupt() on this thread.
- the specified timeout/nanos is not 0 and is expired.
timeout
- timeout in milliseconds.
IllegalArgumentException
- if timeout<0.
InterruptedException
- if another thread called
Thread.interrupt() on this thread.public final void wait() throws InterruptedException
- Another thread called notify on this object, the current
thread is the highest priority thread in the waiting queue and no other thread owns this monitor (i.e., the notifying thread leaves this monitor).
- Another thread called notifyAll on this object and no other
thread owns this monitor (i.e., the notifying thread leaves this monitor).
- Another thread calls Thread.interrupt() on this thread.
IllegalArgumentException
- if timeout<0.
InterruptedException
- if another thread called
Thread.interrupt() on this thread.protected void finalize() throws Throwable
NOTE: The use of finalize() is strongly discouraged for realtime or safety-critical code. This method should only be used for debugging purposes. If used as a last resort to reclaim non-memory resources, finalize() should indicate the resource leak with a loud error message.
There is no guarantee that finalize() will be called, the memory management may decide not to reclaim this object's memory or to delay the call to finalize() to an unspecified point in time. It is therefore recommended never to use the finalize method to release any resources (files, network connections, non-Java memory, etc.) since releasing of these resource may be delayed perpetually.
The order of finalization is not specified, i.e., the finalize method of any two objects that become unreachable may be called in an arbitrary order. It therefore has to be assumed that when finalize() is called on an object, that the finalize() method of any object that is only reachable through this object() has been called as well or is called simultaneously by another thread.
The presence of a finalize-method in any sub-class of Object causes the reclamation of the memory of this object to be delayed until the finalize() method has been executed. The finalize() method is typically executed by the finalizer thread (that may run at a low priority) or by a call to Runtime.runFinalization().
Any code sequence that creates instances of a class that defines a finalize() method must therefore ensure that sufficient CPU time is allocated to the finalizer thread or that Runtime.runFinalization() is called regularly such that the finalize() methods can be executed and the object's memory can be reclaimed.
The finalize method itself should never block or run for long times since it would otherwise block the finalizer thread or the thread that called Runtime.runFinalization() and prevent the execution other finalize() method and consequently prevent the reclamation of these object's memory.
For objects that are allocated in a javax.realtime.ScopedMemory, the finalize() methods will be called when this scoped memory is exited by the last thread. Unlike HeapMemory, which is controlled by the garbage collector, ScopedMemory provides a defined execution point for the finalize() mehods and it is therefore safer to use finalize() here.
Throwable
- this method may throw any exception, it will be
ignored by the finalizer thread or by Runtime.runFinalization.
|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |