/[classpath]/classpath/gnu/classpath/jdwp/id/ObjectId.java
ViewVC logotype

Diff of /classpath/gnu/classpath/jdwp/id/ObjectId.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2.2.1 by gnu_andrew, Tue Aug 2 20:12:08 2005 UTC revision 1.2.2.2 by gnu_andrew, Sat Sep 10 15:31:36 2005 UTC
# Line 40  exception statement from your version. * Line 40  exception statement from your version. *
40  package gnu.classpath.jdwp.id;  package gnu.classpath.jdwp.id;
41    
42  import gnu.classpath.jdwp.JdwpConstants;  import gnu.classpath.jdwp.JdwpConstants;
43    import gnu.classpath.jdwp.exception.InvalidObjectException;
44    
45  import java.io.DataOutputStream;  import java.io.DataOutputStream;
46  import java.io.IOException;  import java.io.IOException;
47    
48  /**  /**
49   * A class which represents a JDWP object id for an object   * This is a base class for all ObjectID-like entities in JDWP,
50     * inculding Objects, ClassObject, ClassLoader, Thread, ThreadGroup,
51     * etc.
52   *   *
53   * @author Keith Seitz  <keiths@redhat.com>   * @author Keith Seitz  <keiths@redhat.com>
54   */   */
# Line 57  public class ObjectId Line 60  public class ObjectId
60     */     */
61    public static final Class typeClass = Object.class;    public static final Class typeClass = Object.class;
62    
63      // Handle to disable garbage collection
64      private Object _handle;
65    
66    /**    /**
67     * Constructs a new <code>ObjectId</code>     * Constructs a new <code>ObjectId</code>
68     */     */
# Line 85  public class ObjectId Line 91  public class ObjectId
91    }    }
92    
93    /**    /**
94       * Returns the object referred to by this ID
95       *
96       * @returns the object
97       * @throws InvalidObjectException if the object was garbage collected
98       *           or is invalid
99       */
100      public Object getObject ()
101        throws InvalidObjectException
102      {
103        Object obj = _reference.get ();
104        if (obj == null)
105          throw new InvalidObjectException (_id);
106    
107        return obj;
108      }
109    
110      /**
111     * Writes the id to the stream     * Writes the id to the stream
112     *     *
113     * @param outStream  the stream to which to write     * @param outStream  the stream to which to write
# Line 96  public class ObjectId Line 119  public class ObjectId
119      // All we need to do is write out our id as an 8-byte integer      // All we need to do is write out our id as an 8-byte integer
120      outStream.writeLong (_id);      outStream.writeLong (_id);
121    }    }
122    
123      /**
124       * Disable garbage collection on object
125       */
126      public void disableCollection ()
127        throws InvalidObjectException
128      {
129        _handle = getObject ();
130      }
131    
132      /**
133       * Enable garbage collection on object
134       */
135      public void enableCollection ()
136      {
137        _handle = null;
138      }
139  }  }

Legend:
Removed from v.1.2.2.1  
changed lines
  Added in v.1.2.2.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26