Java Code Examples for org.apache.hadoop.metrics.Updater

The following examples show how to use org.apache.hadoop.metrics.Updater. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: hadoop   Source File: AbstractMetricsContext.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Timer callback.
 */
private void timerEvent() throws IOException {
  if (isMonitoring) {
    Collection<Updater> myUpdaters;
    synchronized (this) {
      myUpdaters = new ArrayList<Updater>(updaters);
    }     
    // Run all the registered updates without holding a lock
    // on this context
    for (Updater updater : myUpdaters) {
      try {
        updater.doUpdates(this);
      }
      catch (Throwable throwable) {
        throwable.printStackTrace();
      }
    }
    emitRecords();
  }
}
 
Example 2
Source Project: big-c   Source File: AbstractMetricsContext.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Timer callback.
 */
private void timerEvent() throws IOException {
  if (isMonitoring) {
    Collection<Updater> myUpdaters;
    synchronized (this) {
      myUpdaters = new ArrayList<Updater>(updaters);
    }     
    // Run all the registered updates without holding a lock
    // on this context
    for (Updater updater : myUpdaters) {
      try {
        updater.doUpdates(this);
      }
      catch (Throwable throwable) {
        throwable.printStackTrace();
      }
    }
    emitRecords();
  }
}
 
Example 3
Source Project: RDFS   Source File: AbstractMetricsContext.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Timer callback.
 */
private void timerEvent() throws IOException {
  if (isMonitoring) {
    Collection<Updater> myUpdaters;
    synchronized (this) {
      myUpdaters = new ArrayList<Updater>(updaters.keySet());
    }
    // Run all the registered updates without holding a lock
    // on this context
    for (Updater updater : myUpdaters) {
      try {
        updater.doUpdates(this);
      }
      catch (Throwable throwable) {
        throwable.printStackTrace();
      }
    }
    emitRecords();
  }
}
 
Example 4
Source Project: hadoop-gpu   Source File: AbstractMetricsContext.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Timer callback.
 */
private void timerEvent() throws IOException {
  if (isMonitoring) {
    Collection<Updater> myUpdaters;
    synchronized (this) {
      myUpdaters = new ArrayList<Updater>(updaters);
    }     
    // Run all the registered updates without holding a lock
    // on this context
    for (Updater updater : myUpdaters) {
      try {
        updater.doUpdates(this);
      }
      catch (Throwable throwable) {
        throwable.printStackTrace();
      }
    }
    emitRecords();
  }
}
 
Example 5
Source Project: hadoop   Source File: CompositeContext.java    License: Apache License 2.0 5 votes vote down vote up
@InterfaceAudience.Private
@Override
public void registerUpdater(Updater updater) {
  for (MetricsContext ctxt : subctxt) {
    ctxt.registerUpdater(updater);
  }
}
 
Example 6
Source Project: hadoop   Source File: CompositeContext.java    License: Apache License 2.0 5 votes vote down vote up
@InterfaceAudience.Private
@Override
public void unregisterUpdater(Updater updater) {
  for (MetricsContext ctxt : subctxt) {
    ctxt.unregisterUpdater(updater);
  }
}
 
Example 7
Source Project: big-c   Source File: CompositeContext.java    License: Apache License 2.0 5 votes vote down vote up
@InterfaceAudience.Private
@Override
public void registerUpdater(Updater updater) {
  for (MetricsContext ctxt : subctxt) {
    ctxt.registerUpdater(updater);
  }
}
 
Example 8
Source Project: big-c   Source File: CompositeContext.java    License: Apache License 2.0 5 votes vote down vote up
@InterfaceAudience.Private
@Override
public void unregisterUpdater(Updater updater) {
  for (MetricsContext ctxt : subctxt) {
    ctxt.unregisterUpdater(updater);
  }
}
 
Example 9
Source Project: RDFS   Source File: CompositeContext.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void registerUpdater(Updater updater) {
  for (MetricsContext ctxt : subctxt) {
    ctxt.registerUpdater(updater);
  }
}
 
Example 10
Source Project: RDFS   Source File: CompositeContext.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void unregisterUpdater(Updater updater) {
  for (MetricsContext ctxt : subctxt) {
    ctxt.unregisterUpdater(updater);
  }
}
 
Example 11
Source Project: hadoop-gpu   Source File: CompositeContext.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void registerUpdater(Updater updater) {
  for (MetricsContext ctxt : subctxt) {
    ctxt.registerUpdater(updater);
  }
}
 
Example 12
Source Project: hadoop-gpu   Source File: CompositeContext.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void unregisterUpdater(Updater updater) {
  for (MetricsContext ctxt : subctxt) {
    ctxt.unregisterUpdater(updater);
  }
}
 
Example 13
Source Project: hadoop   Source File: AbstractMetricsContext.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Registers a callback to be called at time intervals determined by
 * the configuration.
 *
 * @param updater object to be run periodically; it should update
 * some metrics records 
 */
public synchronized void registerUpdater(final Updater updater) {
  if (!updaters.contains(updater)) {
    updaters.add(updater);
  }
}
 
Example 14
Source Project: hadoop   Source File: AbstractMetricsContext.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Removes a callback, if it exists.
 *
 * @param updater object to be removed from the callback list
 */
public synchronized void unregisterUpdater(Updater updater) {
  updaters.remove(updater);
}
 
Example 15
Source Project: big-c   Source File: AbstractMetricsContext.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Registers a callback to be called at time intervals determined by
 * the configuration.
 *
 * @param updater object to be run periodically; it should update
 * some metrics records 
 */
public synchronized void registerUpdater(final Updater updater) {
  if (!updaters.contains(updater)) {
    updaters.add(updater);
  }
}
 
Example 16
Source Project: big-c   Source File: AbstractMetricsContext.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Removes a callback, if it exists.
 *
 * @param updater object to be removed from the callback list
 */
public synchronized void unregisterUpdater(Updater updater) {
  updaters.remove(updater);
}
 
Example 17
Source Project: RDFS   Source File: AbstractMetricsContext.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Registers a callback to be called at time intervals determined by
 * the configuration.
 *
 * @param updater object to be run periodically; it should update
 * some metrics records
 */
public synchronized void registerUpdater(final Updater updater) {
  if (!updaters.containsKey(updater)) {
    updaters.put(updater, Boolean.TRUE);
  }
}
 
Example 18
Source Project: RDFS   Source File: AbstractMetricsContext.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Removes a callback, if it exists.
 *
 * @param updater object to be removed from the callback list
 */
public synchronized void unregisterUpdater(Updater updater) {
  updaters.remove(updater);
}
 
Example 19
Source Project: hadoop-gpu   Source File: AbstractMetricsContext.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Registers a callback to be called at time intervals determined by
 * the configuration.
 *
 * @param updater object to be run periodically; it should update
 * some metrics records 
 */
public synchronized void registerUpdater(final Updater updater) {
  if (!updaters.contains(updater)) {
    updaters.add(updater);
  }
}
 
Example 20
Source Project: hadoop-gpu   Source File: AbstractMetricsContext.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Removes a callback, if it exists.
 *
 * @param updater object to be removed from the callback list
 */
public synchronized void unregisterUpdater(Updater updater) {
  updaters.remove(updater);
}