/** * 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 synchronized boolean equals(Object genericRight) { if (genericRight instanceof CounterGroupBase<?>) { @SuppressWarnings("unchecked") CounterGroupBase<Counter> right = ((CounterGroupBase<Counter>) genericRight).getUnderlyingGroup(); return Iterators.elementsEqual(iterator(), right.iterator()); } return false; }
@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 synchronized boolean equals(Object genericRight) { if (genericRight instanceof CounterGroupBase<?>) { @SuppressWarnings("unchecked") CounterGroupBase<Counter> right = ((CounterGroupBase<Counter>) genericRight).getUnderlyingGroup(); return Iterators.elementsEqual(iterator(), right.iterator()); } return false; }
@Override public synchronized boolean equals(Object genericRight) { if (genericRight instanceof CounterGroupBase<?>) { @SuppressWarnings("unchecked") CounterGroupBase<Counter> right = ((CounterGroupBase<Counter>) genericRight).getUnderlyingGroup(); return Iterators.elementsEqual(iterator(), right.iterator()); } return false; }
@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 synchronized boolean equals(Object genericRight) { if (genericRight instanceof CounterGroupBase<?>) { @SuppressWarnings("unchecked") CounterGroupBase<Counter> right = ((CounterGroupBase<Counter>) genericRight).getUnderlyingGroup(); return Iterators.elementsEqual(iterator(), right.iterator()); } return false; }
@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()); } } }
/** * Write the set of groups. * Counters ::= version #fgroups (groupId, group)* #groups (group)* */ @Override public synchronized void write(DataOutput out) throws IOException { WritableUtils.writeVInt(out, groupFactory.version()); WritableUtils.writeVInt(out, fgroups.size()); // framework groups first for (G group : fgroups.values()) { if (group.getUnderlyingGroup() instanceof FrameworkCounterGroup<?, ?>) { WritableUtils.writeVInt(out, GroupType.FRAMEWORK.ordinal()); WritableUtils.writeVInt(out, getFrameworkGroupId(group.getName())); group.write(out); } else if (group.getUnderlyingGroup() instanceof FileSystemCounterGroup<?>) { WritableUtils.writeVInt(out, GroupType.FILESYSTEM.ordinal()); group.write(out); } } if (writeAllCounters) { WritableUtils.writeVInt(out, groups.size()); for (G group : groups.values()) { Text.writeString(out, group.getName()); group.write(out); } } else { WritableUtils.writeVInt(out, 0); } }
/** * Write the set of groups. * Counters ::= version #fgroups (groupId, group)* #groups (group)* */ @Override public synchronized void write(DataOutput out) throws IOException { WritableUtils.writeVInt(out, groupFactory.version()); WritableUtils.writeVInt(out, fgroups.size()); // framework groups first for (G group : fgroups.values()) { if (group.getUnderlyingGroup() instanceof FrameworkCounterGroup<?, ?>) { WritableUtils.writeVInt(out, GroupType.FRAMEWORK.ordinal()); WritableUtils.writeVInt(out, getFrameworkGroupId(group.getName())); group.write(out); } else if (group.getUnderlyingGroup() instanceof FileSystemCounterGroup<?>) { WritableUtils.writeVInt(out, GroupType.FILESYSTEM.ordinal()); group.write(out); } } if (writeAllCounters) { WritableUtils.writeVInt(out, groups.size()); for (G group : groups.values()) { Text.writeString(out, group.getName()); group.write(out); } } else { WritableUtils.writeVInt(out, 0); } }
/** * Write the set of groups. * Counters ::= version #fgroups (groupId, group)* #groups (group)* */ @Override public synchronized void write(DataOutput out) throws IOException { WritableUtils.writeVInt(out, groupFactory.version()); WritableUtils.writeVInt(out, fgroups.size()); // framework groups first for (G group : fgroups.values()) { if (group.getUnderlyingGroup() instanceof FrameworkCounterGroup<?, ?>) { WritableUtils.writeVInt(out, GroupType.FRAMEWORK.ordinal()); WritableUtils.writeVInt(out, getFrameworkGroupId(group.getName())); group.write(out); } else if (group.getUnderlyingGroup() instanceof FileSystemCounterGroup<?>) { WritableUtils.writeVInt(out, GroupType.FILESYSTEM.ordinal()); group.write(out); } } if (writeAllCounters) { WritableUtils.writeVInt(out, groups.size()); for (G group : groups.values()) { Text.writeString(out, group.getName()); group.write(out); } } else { WritableUtils.writeVInt(out, 0); } }
/** * Write the set of groups. * Counters ::= version #fgroups (groupId, group)* #groups (group)* */ @Override public synchronized void write(DataOutput out) throws IOException { WritableUtils.writeVInt(out, groupFactory.version()); WritableUtils.writeVInt(out, fgroups.size()); // framework groups first for (G group : fgroups.values()) { if (group.getUnderlyingGroup() instanceof FrameworkCounterGroup<?, ?>) { WritableUtils.writeVInt(out, GroupType.FRAMEWORK.ordinal()); WritableUtils.writeVInt(out, getFrameworkGroupId(group.getName())); group.write(out); } else if (group.getUnderlyingGroup() instanceof FileSystemCounterGroup<?>) { WritableUtils.writeVInt(out, GroupType.FILESYSTEM.ordinal()); group.write(out); } } if (writeAllCounters) { WritableUtils.writeVInt(out, groups.size()); for (G group : groups.values()) { Text.writeString(out, group.getName()); group.write(out); } } else { WritableUtils.writeVInt(out, 0); } }