~ubuntu-branches/ubuntu/precise/classpath/precise

« back to all changes in this revision

Viewing changes to vm/reference/gnu/classpath/jdwp/VMIdManager.java

  • Committer: Bazaar Package Importer
  • Author(s): Michael Koch
  • Date: 2006-05-27 16:11:15 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20060527161115-h6e39eposdt5snb6
Tags: 2:0.91-3
* Install header files to /usr/include/classpath.
* debian/control: classpath: Conflict with jamvm < 1.4.3 and
  cacao < 0.96 (Closes: #368172).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* VMIdManager.java -- A reference/example implementation of a manager for
2
2
   JDWP object/reference type IDs
3
3
 
4
 
   Copyright (C) 2005 Free Software Foundation
 
4
   Copyright (C) 2005, 2006 Free Software Foundation
5
5
 
6
6
This file is part of GNU Classpath.
7
7
 
48
48
import java.lang.ref.Reference;
49
49
import java.lang.ref.ReferenceQueue;
50
50
import java.lang.ref.SoftReference;
51
 
import java.io.IOException;
52
51
import java.nio.ByteBuffer;
53
52
import java.util.HashMap;
54
53
import java.util.Hashtable;
55
 
import java.util.Iterator;
56
54
 
57
55
/**
58
56
 * This class manages objects and referencetypes that are reported
76
74
 * <b>NOTE:</b> All IDs handled by the ID manager (all object and reference
77
75
 * type IDs) are assumed to be of type <code>long</code>.
78
76
 *
 
77
 * <b>NOTE:</b> This class does not manage virtual machine-specific types,
 
78
 * like methods, fields, and frames. These already have unique IDs within
 
79
 * the virtual machine and do not need further abstraction here.
 
80
 *
79
81
 * @author Keith Seitz  (keiths@redhat.com)
80
82
 */
81
83
public class VMIdManager
99
101
      // ObjectId and ArrayId are special cases. See newObjectId.
100
102
      _idList.put (ClassLoaderId.typeClass, ClassLoaderId.class);
101
103
      _idList.put (ClassObjectId.typeClass, ClassObjectId.class);
102
 
      //_idList.put (FieldId.typeClass, FieldId.class);
103
 
      //_idList.put (FrameId.typeClass, FrameId.class);
104
 
      //_idList.put (MethodId.typeClass, MethodId.class);
105
104
      _idList.put (StringId.typeClass, StringId.class);
106
105
      _idList.put (ThreadId.typeClass, ThreadId.class);
107
106
      _idList.put (ThreadGroupId.typeClass, ThreadGroupId.class);
110
109
    /**
111
110
     * Returns a new id for the given object
112
111
     *
113
 
     * @param object  the object for which an id is desired
 
112
     * @param obj  SoftReference of the object for which an id is desired
114
113
     * @returns a suitable object id
115
114
     */
116
115
    public static ObjectId newObjectId (SoftReference obj)
170
169
    /**
171
170
     * Returns a new reference type id for the given class
172
171
     *
173
 
     * @param clazz  the <code>Class</code> for which an id is desired
 
172
     * @param ref  SoftReference to the desired type
174
173
     * @returns a suitable reference type id or null when the
175
174
     * reference is cleared.
176
175
     */
187
186
        id = new InterfaceReferenceTypeId ();
188
187
      else
189
188
        id = new ClassReferenceTypeId ();
 
189
      id.setReference (ref);
190
190
      synchronized (_ridLock)
191
191
        {
192
192
          id.setId (++_lastRid);