aicas logoJamaica 6.4 release 1

java.lang
Class Object

java.lang.Object

public class Object

Object is the base class for all classes in Java.

Since:
1.0

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

Object

public Object()
Method Detail

getClass

public final Class<?> getClass()
getClass obtains a reference to the class associated with this object.

Returns:
the class of this instance, never null.

hashCode

public int hashCode()
hashCode returns a hash code for this object. The hash code must be equal for two objects a and b if a.equals(b) is true.

The default implementation returns System.identityHashCode(this).

Returns:
a hash code value.

notify

public final void notify()
notify wakes up one thread of the set of threads wait()ing for this object's monitor. notify may only be called if the current thread has entered this object's monitor (by a synchronized() statement or a synchronized method). The thread that is woken up may resume execution as soon as the current thread releases the monitor associated with this object.

For JamaicaVM: The thread that wait()ed for notification longest will be woken up first.

Throws:
IllegalMonitorStateException - if the current thread did not enter this object's monitor.

notifyAll

public final void notifyAll()
notifyAll wakes up all threads of the set of threads wait()ing for this object's monitor. notifyAll may only be called if the current thread has entered this object's monitor (by a synchronized() statement or a synchronized method). The threads that are woken up may resume execution as soon as the current thread releases the monitor associated with this object.

For JamaicaVM: The thread that wait()ed for notification longest will be woken up first.

Throws:
IllegalMonitorStateException - if the current thread did not enter this object's monitor.

equals

public boolean equals(Object other)
equals compares this object to another object.

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.

Parameters:
other - the other object.
Returns:
if this and other are considered equal.

clone

protected Object clone()
                throws CloneNotSupportedException
clone creates a shallow clone of this.

Returns:
a clone of this object.
Throws:
CloneNotSupportedException - if this does not implement the Cloneable interface, OutOfMemoryError if we run out of memory.

toString

public String toString()
toString creates a printable string that represents this object for debugging purposes.

The default implementation returns getClass().getName() + '@' + Integer.toHexString(hashCode()).

Returns:
a string identifying this object.

wait

public final void wait(long timeout,
                       int nanos)
                throws InterruptedException
wait causes this thread to block until one of the following events happened:

- 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.

Parameters:
timeout - timeout in milliseconds.
nanos - timeout in nanoseconds.
Throws:
IllegalArgumentException - if timeout<0, nanos<0 or nanos>999999.
InterruptedException - if another thread called Thread.interrupt() on this thread.

wait

public final void wait(long timeout)
                throws InterruptedException
wait causes this thread to block until one of the following events happened:

- 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.

Parameters:
timeout - timeout in milliseconds.
Throws:
IllegalArgumentException - if timeout<0.
InterruptedException - if another thread called Thread.interrupt() on this thread.

wait

public final void wait()
                throws InterruptedException
wait causes this thread to block until one of the following events happened:

- 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.

Throws:
IllegalArgumentException - if timeout<0.
InterruptedException - if another thread called Thread.interrupt() on this thread.

finalize

protected void finalize()
                 throws Throwable
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.

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.

Throws:
Throwable - this method may throw any exception, it will be ignored by the finalizer thread or by Runtime.runFinalization.

aicas logoJamaica 6.4 release 1

aicas GmbH, Karlsruhe, Germany —www.aicas.com
Copyright © 2001-2015 aicas GmbH. All Rights Reserved.