@Override public C findCounter(String counterName) { return findCounter(counterName, false); }
@Override public C addCounter(String name, String displayName, long value) { C counter = findCounter(name); if (counter != null) { counter.setValue(value); } return counter; }
@Override public C addCounter(String name, String displayName, long value) { C counter = findCounter(name); if (counter != null) { counter.setValue(value); } return counter; }
@Override public C addCounter(String name, String displayName, long value) { C counter = findCounter(name); if (counter != null) { counter.setValue(value); } return counter; }
@Override public C addCounter(String name, String displayName, long value) { C counter = findCounter(name); if (counter != null) { counter.setValue(value); } return counter; }
@Override public C findCounter(String counterName, boolean create) { try { String[] pair = parseCounterName(counterName); return findCounter(pair[0], FileSystemCounter.valueOf(pair[1])); } catch (Exception e) { if (create) throw new IllegalArgumentException(e); LOG.warn(counterName + " is not a recognized counter."); return null; } }
@Override public C findCounter(String counterName, boolean create) { try { String[] pair = parseCounterName(counterName); return findCounter(pair[0], FileSystemCounter.valueOf(pair[1])); } catch (Exception e) { if (create) throw new IllegalArgumentException(e); LOG.warn(counterName + " is not a recognized counter."); return null; } }
@Override public C findCounter(String counterName, boolean create) { try { String[] pair = parseCounterName(counterName); return findCounter(pair[0], FileSystemCounter.valueOf(pair[1])); } catch (Exception e) { if (create) throw new IllegalArgumentException(e); LOG.warn(counterName + " is not a recognized counter."); return null; } }
@Override public void addCounter(C counter) { C ours; if (counter instanceof FileSystemCounterGroup.FSCounter) { FSCounter c = (FSCounter) counter; ours = findCounter(c.scheme, c.key); } else { ours = findCounter(counter.getName()); } if (ours != null) { ours.setValue(counter.getValue()); } }
/** * Find the file system counter for the given scheme and enum. * @param scheme of the file system * @param key the enum of the counter * @return the file system counter */ @InterfaceAudience.Private public synchronized C findCounter(String scheme, FileSystemCounter key) { return ((FileSystemCounterGroup<C>) getGroup( FileSystemCounter.class.getName()).getUnderlyingGroup()). findCounter(scheme, key); }
/** * Find the file system counter for the given scheme and enum. * @param scheme of the file system * @param key the enum of the counter * @return the file system counter */ @InterfaceAudience.Private public synchronized C findCounter(String scheme, FileSystemCounter key) { return ((FileSystemCounterGroup<C>) getGroup( FileSystemCounter.class.getName()).getUnderlyingGroup()). findCounter(scheme, key); }
/** * Find the file system counter for the given scheme and enum. * @param scheme of the file system * @param key the enum of the counter * @return the file system counter */ @InterfaceAudience.Private public synchronized C findCounter(String scheme, FileSystemCounter key) { return ((FileSystemCounterGroup<C>) getGroup( FileSystemCounter.class.getName()).getUnderlyingGroup()). findCounter(scheme, key); }
/** * Find the file system counter for the given scheme and enum. * @param scheme of the file system * @param key the enum of the counter * @return the file system counter */ @InterfaceAudience.Private public synchronized C findCounter(String scheme, FileSystemCounter key) { return ((FileSystemCounterGroup<C>) getGroup( FileSystemCounter.class.getName()).getUnderlyingGroup()). findCounter(scheme, key); }
@Override public C findCounter(String counterName, boolean create) { try { String[] pair = parseCounterName(counterName); return findCounter(pair[0], FileSystemCounter.valueOf(pair[1])); } catch (Exception e) { if (create) throw new IllegalArgumentException(e); LOG.warn(counterName + " is not a recognized counter."); return null; } }
@Override @SuppressWarnings("unchecked") public void incrAllCounters(CounterGroupBase<C> other) { if (checkNotNull(other.getUnderlyingGroup(), "other group") instanceof FileSystemCounterGroup<?>) { for (Counter counter : other) { FSCounter c = (FSCounter) ((Counter)counter).getUnderlyingCounter(); findCounter(c.scheme, c.key) .increment(counter.getValue()); } } }
@Override @SuppressWarnings("unchecked") public void incrAllCounters(CounterGroupBase<C> other) { if (checkNotNull(other.getUnderlyingGroup(), "other group") instanceof FileSystemCounterGroup<?>) { for (Counter counter : other) { FSCounter c = (FSCounter) ((Counter)counter).getUnderlyingCounter(); findCounter(c.scheme, c.key) .increment(counter.getValue()); } } }
@Override @SuppressWarnings("unchecked") public void incrAllCounters(CounterGroupBase<C> other) { if (checkNotNull(other.getUnderlyingGroup(), "other group") instanceof FileSystemCounterGroup<?>) { for (Counter counter : other) { FSCounter c = (FSCounter) ((Counter)counter).getUnderlyingCounter(); findCounter(c.scheme, c.key) .increment(counter.getValue()); } } }
@Override @SuppressWarnings("unchecked") public void incrAllCounters(CounterGroupBase<C> other) { if (checkNotNull(other.getUnderlyingGroup(), "other group") instanceof FileSystemCounterGroup<?>) { for (Counter counter : other) { FSCounter c = (FSCounter) ((Counter)counter).getUnderlyingCounter(); findCounter(c.scheme, c.key) .increment(counter.getValue()); } } }
@Override public void readFields(DataInput in) throws IOException { int numSchemes = WritableUtils.readVInt(in); // #scheme FileSystemCounter[] enums = FileSystemCounter.values(); for (int i = 0; i < numSchemes; ++i) { String scheme = WritableUtils.readString(in); // scheme int numCounters = WritableUtils.readVInt(in); // #counter for (int j = 0; j < numCounters; ++j) { findCounter(scheme, enums[WritableUtils.readVInt(in)]) // key .setValue(WritableUtils.readVLong(in)); // value } } }
@Override public void readFields(DataInput in) throws IOException { int numSchemes = WritableUtils.readVInt(in); // #scheme FileSystemCounter[] enums = FileSystemCounter.values(); for (int i = 0; i < numSchemes; ++i) { String scheme = WritableUtils.readString(in); // scheme int numCounters = WritableUtils.readVInt(in); // #counter for (int j = 0; j < numCounters; ++j) { findCounter(scheme, enums[WritableUtils.readVInt(in)]) // key .setValue(WritableUtils.readVLong(in)); // value } } }