[cp-patches] Re: RFA JDWP ClassUnloadEvent

Kyle Galloway kgallowa at redhat.com
Mon Jun 12 21:21:08 UTC 2006


Ok, fixed that, I think this is probably the better way to do it, I 
hadn't though about when the event would get passed from the VM and this 
will work both ways.

Kyle

Keith Seitz wrote:
> Some questions about this...
>
> Kyle Galloway wrote:
>
>> +  /**
>> +   * Constructs a new <code>ClassUnloadEvent</code>
>> +   * +   * @param clazz class which was prepared
>> +   */
>> +  public ClassUnloadEvent(Class clazz)
>> +  {
>> +    super(JdwpConstants.EventKind.CLASS_UNLOAD);
>> +    _class = clazz;
>> +  }
>
> Do you intend for this event to be generated just before the class is 
> unloaded or just after? If after, the class's Class object will be 
> gone, and this constructor cannot be used. If the constructor is going 
> to take a Class argument, it should be documented that you expect this 
> notification to happen just before the type is unloaded. [more on this 
> later]
>
>> +  /**
>> +   * Writes the event to the given stream
>> +   * +   * @param outStream the output stream to write the event to
>> +   */
>> +  protected void _writeData(DataOutputStream outStream) +    throws 
>> IOException
>> +  {
>> +    VMIdManager idm = VMIdManager.getDefault();
>> +    ReferenceTypeId rid = idm.getReferenceTypeId(_class);
>> +
>> +    rid.writeTagged(outStream);
>> +    JdwpString.writeString(outStream, 
>> Signature.computeClassSignature(_class));
>> +  }
>> +
>> +}
>
> I don't think we output the reference type id -- just the type's 
> signature.
>
> Back to the notification before/after the "unload" issue: I think 
> we're probably safest just getting the type signature (as a String) 
> from the VM instead of the Class object. That way, it won't matter 
> whether the class has actually been unloaded or whether it is about to 
> be.
>
> Keith

-------------- next part --------------
A non-text attachment was scrubbed...
Name: jdwp-classunload.patch
Type: text/x-patch
Size: 3481 bytes
Desc: not available
Url : http://developer.classpath.org/pipermail/classpath-patches/attachments/20060612/f4fee2a9/jdwp-classunload.bin


More information about the Classpath-patches mailing list