445
446 if (nanos < 0 || nanos > 999999) {
447 throw new IllegalArgumentException(
448 "nanosecond timeout value out of range");
449 }
450
451 if (nanos > 0 && timeoutMillis < Long.MAX_VALUE) {
452 timeoutMillis++;
453 }
454
455 wait(timeoutMillis);
456 }
457
458 /**
459 * Called by the garbage collector on an object when garbage collection
460 * determines that there are no more references to the object.
461 * A subclass overrides the {@code finalize} method to dispose of
462 * system resources or to perform other cleanup.
463 * <p>
464 * The general contract of {@code finalize} is that it is invoked
465 * if and when the Java™ virtual
466 * machine has determined that there is no longer any
467 * means by which this object can be accessed by any thread that has
468 * not yet died, except as a result of an action taken by the
469 * finalization of some other object or class which is ready to be
470 * finalized. The {@code finalize} method may take any action, including
471 * making this object available again to other threads; the usual purpose
472 * of {@code finalize}, however, is to perform cleanup actions before
473 * the object is irrevocably discarded. For example, the finalize method
474 * for an object that represents an input/output connection might perform
475 * explicit I/O transactions to break the connection before the object is
476 * permanently discarded.
477 * <p>
478 * The {@code finalize} method of class {@code Object} performs no
479 * special action; it simply returns normally. Subclasses of
480 * {@code Object} may override this definition.
481 * <p>
482 * The Java programming language does not guarantee which thread will
483 * invoke the {@code finalize} method for any given object. It is
484 * guaranteed, however, that the thread that invokes finalize will not
485 * be holding any user-visible synchronization locks when finalize is
|
445
446 if (nanos < 0 || nanos > 999999) {
447 throw new IllegalArgumentException(
448 "nanosecond timeout value out of range");
449 }
450
451 if (nanos > 0 && timeoutMillis < Long.MAX_VALUE) {
452 timeoutMillis++;
453 }
454
455 wait(timeoutMillis);
456 }
457
458 /**
459 * Called by the garbage collector on an object when garbage collection
460 * determines that there are no more references to the object.
461 * A subclass overrides the {@code finalize} method to dispose of
462 * system resources or to perform other cleanup.
463 * <p>
464 * The general contract of {@code finalize} is that it is invoked
465 * if and when the Java virtual
466 * machine has determined that there is no longer any
467 * means by which this object can be accessed by any thread that has
468 * not yet died, except as a result of an action taken by the
469 * finalization of some other object or class which is ready to be
470 * finalized. The {@code finalize} method may take any action, including
471 * making this object available again to other threads; the usual purpose
472 * of {@code finalize}, however, is to perform cleanup actions before
473 * the object is irrevocably discarded. For example, the finalize method
474 * for an object that represents an input/output connection might perform
475 * explicit I/O transactions to break the connection before the object is
476 * permanently discarded.
477 * <p>
478 * The {@code finalize} method of class {@code Object} performs no
479 * special action; it simply returns normally. Subclasses of
480 * {@code Object} may override this definition.
481 * <p>
482 * The Java programming language does not guarantee which thread will
483 * invoke the {@code finalize} method for any given object. It is
484 * guaranteed, however, that the thread that invokes finalize will not
485 * be holding any user-visible synchronization locks when finalize is
|