Package gnu.classpath.jdwp.id

Examples of gnu.classpath.jdwp.id.ObjectId


  }

  private void executeValue(ByteBuffer bb, DataOutputStream os)
      throws JdwpException, IOException
  {
    ObjectId oid = idMan.readObjectId(bb);

    String str = (String) oid.getObject();
    JdwpString.writeString(os, str);
  }
View Full Code Here


  }

  private void executeName(ByteBuffer bb, DataOutputStream os)
    throws JdwpException, IOException
  {
    ObjectId oid = idMan.readObjectId(bb);
    ThreadGroup group = (ThreadGroup) oid.getObject();
    JdwpString.writeString(os, group.getName());
  }
View Full Code Here

  }

  private void executeParent(ByteBuffer bb, DataOutputStream os)
    throws JdwpException, IOException
  {
    ObjectId oid = idMan.readObjectId(bb);
    ThreadGroup group = (ThreadGroup) oid.getObject();
    ThreadGroup parent = group.getParent();
    if (parent == null) {
      os.writeLong(0L);
    } else {
    ObjectId parentId = idMan.getObjectId(parent);
    parentId.write(os);
  }
  }
View Full Code Here

  }

  private void executeChildren(ByteBuffer bb, DataOutputStream os)
    throws JdwpException, IOException
  {
    ObjectId oid = idMan.readObjectId(bb);
    ThreadGroup group = (ThreadGroup) oid.getObject();

    ThreadGroup jdwpGroup = Thread.currentThread().getThreadGroup();
    int numThreads = group.activeCount();
    Thread allThreads[] = new Thread[numThreads];
View Full Code Here

  private void executeCreateString(ByteBuffer bb, DataOutputStream os)
    throws JdwpException, IOException
  {
    String string = JdwpString.readString(bb);
    ObjectId stringId = idMan.getObjectId(string);
   
    // Since this string isn't referenced anywhere we'll disable garbage
    // collection on it so it's still around when the debugger gets back to it.
    stringId.disableCollection();
    stringId.write(os);
  }
View Full Code Here

public ObjectId getObjectId(Object theObject)
{
  /* if (theObject == null)
   return new NullObjectId(); */
  ReferenceKey ref = new ReferenceKey(theObject, refQueue);
  ObjectId id = (ObjectId) oidTable.get(ref);
  if (id == null)
  {
   update();
   id = newObjectId(ref);
   oidTable.put(ref, id);
   idTable.put(new Long(id.getId()), id);
  }
  return id;
}
View Full Code Here

}

public ObjectId get(long id)
  throws InvalidObjectException
{
  ObjectId oid = (ObjectId) idTable.get(new Long(id));
  if (oid == null)
   throw new InvalidObjectException(id);
  return oid;
}
View Full Code Here

private void update()
{
  Reference ref;
  while ((ref = refQueue.poll()) != null)
  {
   ObjectId id = (ObjectId) oidTable.get(ref);
   oidTable.remove(ref);
   idTable.remove(new Long(id.getId()));
  }
}
View Full Code Here

  }
}

private static ObjectId newObjectId(SoftReference obj)
{
  ObjectId id = null;
  Object object = obj.get();
  if (object.getClass().isArray())
   id = new ArrayId();
   else
   {
    for (Class myClass = object.getClass(); myClass != null;
         myClass = myClass.getSuperclass())
    {
     Class clz = (Class) idList.get(myClass);
     if (clz != null)
     {
      try
      {
       id = (ObjectId) clz.newInstance();
       synchronized (idLock)
       {
        id.setId(++lastId);
       }
       id.setReference(obj);
       return id;
      }
      catch (InstantiationException e)
      {
       throw new RuntimeException("cannot create new ID", e);
      }
      catch (IllegalAccessException e)
      {
       throw new RuntimeException("illegal access of ID", e);
      }
     }
    }
    id = new ObjectId();
   }
  synchronized (idLock)
  {
   id.setId(++lastId);
  }
  id.setReference(obj);
  return id;
}
View Full Code Here

TOP

Related Classes of gnu.classpath.jdwp.id.ObjectId

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.