home *** CD-ROM | disk | FTP | other *** search
- package sun.rmi.transport;
-
- import java.rmi.server.LogStream;
- import sun.misc.Ref;
-
- public class WeakRef extends Ref {
- private int hashValue;
- private Object hardref;
-
- public WeakRef(Object var1) {
- this.hashValue = var1.hashCode();
- this.setThing(var1);
- }
-
- public synchronized void pin() {
- if (this.hardref == null) {
- if (DGCImpl.logLevel >= 20) {
- LogStream.log("dgc").println("WeakRef.pin: ref = " + this);
- }
-
- this.hardref = ((Ref)this).check();
- }
-
- }
-
- public synchronized void unpin() {
- if (((Ref)this).check() == null && this.hardref != null) {
- if (DGCImpl.logLevel >= 20) {
- LogStream.log("dgc").println("WeakRef.unpin: ref = " + this);
- }
-
- this.setThing(this.hardref);
- }
-
- this.hardref = null;
- }
-
- public Object reconstitute() {
- return this.hardref;
- }
-
- public synchronized void setThing(Object var1) {
- this.hashValue = var1.hashCode();
- super.setThing(var1);
- if (this.hardref != null) {
- this.hardref = var1;
- }
-
- }
-
- public int hashCode() {
- return this.hashValue;
- }
-
- public boolean equals(Object var1) {
- if (var1 == this) {
- return true;
- } else {
- Object var2 = ((Ref)this).get();
- return var2 != null && var2 == var1;
- }
- }
- }
-