Source for gnu.classpath.jdwp.util.MonitorInfo

   1: /* MonitorInfo.java -- class used to return monitor information
   2:    for JDWP.
   3: 
   4:    Copyright (C) 2007 Free Software Foundation
   5: 
   6: This file is part of GNU Classpath.
   7: 
   8: GNU Classpath is free software; you can redistribute it and/or modify
   9: it under the terms of the GNU General Public License as published by
  10: the Free Software Foundation; either version 2, or (at your option)
  11: any later version.
  12: 
  13: GNU Classpath is distributed in the hope that it will be useful, but
  14: WITHOUT ANY WARRANTY; without even the implied warranty of
  15: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  16: General Public License for more details.
  17: 
  18: You should have received a copy of the GNU General Public License
  19: along with GNU Classpath; see the file COPYING.  If not, write to the
  20: Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  21: 02110-1301 USA.
  22: 
  23: Linking this library statically or dynamically with other modules is
  24: making a combined work based on this library.  Thus, the terms and
  25: conditions of the GNU General Public License cover the whole
  26: combination.
  27: 
  28: As a special exception, the copyright holders of this library give you
  29: permission to link this library with independent modules to produce an
  30: executable, regardless of the license terms of these independent
  31: modules, and to copy and distribute the resulting executable under
  32: terms of your choice, provided that you also meet, for each linked
  33: terms of your choice, provided that you also meet, for each linked
  34: independent module, the terms and conditions of the license of that
  35: module.  An independent module is a module which is not derived from
  36: or based on this library.  If you modify this library, you may extend
  37: this exception to your version of the library, but you are not
  38: obligated to do so.  If you do not wish to do so, delete this
  39: exception statement from your version. */
  40: 
  41: 
  42: package gnu.classpath.jdwp.util;
  43: 
  44: import gnu.classpath.jdwp.VMIdManager;
  45: import gnu.classpath.jdwp.id.ObjectId;
  46: 
  47: import java.io.DataOutputStream;
  48: import java.io.IOException;
  49: 
  50: /**
  51:  * This class is used to pass monitor information between
  52:  * the JDWP back-end and the virtual machine.
  53:  *
  54:  * @author Keith Seitz  (keiths@redhat.com)
  55:  */
  56: public class MonitorInfo
  57: {
  58:   public int entryCount;
  59:   public Thread owner;
  60:   public Thread[] waiters;
  61: 
  62:   public void write(DataOutputStream os)
  63:     throws IOException
  64:   {
  65:     VMIdManager idm = VMIdManager.getDefault();
  66:     ObjectId id = idm.getObjectId(owner);
  67:     id.write(os);
  68:     os.write(entryCount);
  69:     os.write(waiters.length);
  70:     for (int i = 0; i < waiters.length; ++i)
  71:       {
  72:         id = idm.getObjectId(waiters[i]);
  73:         id.write(os);
  74:       }
  75:   }
  76: }