Exemplo n.º 1
0
 /**
  * Get a copy of the remote instrumentation buffer.
  *
  * <p>The data in the remote instrumentation buffer is copied into the local byte buffer.
  *
  * @param buffer the buffer to receive the copy of the remote instrumentation buffer.
  * @throws RemoteException Thrown on any communications errors with the remote system.
  */
 public void sample(ByteBuffer buffer) throws RemoteException {
   assert buffer != null;
   assert rvm != null;
   synchronized (buffer) {
     buffer.clear();
     buffer.put(rvm.getBytes());
   }
 }
Exemplo n.º 2
0
  /**
   * Create a PerfDataBuffer instance for accessing the specified instrumentation buffer.
   *
   * @param rvm the proxy to the remote MonitredVm object
   * @param lvmid the local Java Virtual Machine Identifier of the remote target.
   * @throws MonitorException
   */
  public PerfDataBuffer(RemoteVm rvm, int lvmid) throws MonitorException {

    this.rvm = rvm;
    try {
      ByteBuffer buffer = ByteBuffer.allocate(rvm.getCapacity());
      sample(buffer);
      createPerfDataBuffer(buffer, lvmid);

    } catch (RemoteException e) {
      throw new MonitorException("Could not read data for remote JVM " + lvmid, e);
    }
  }