@Override public Snapshot getSnapshot() { final long[] values = new long[size()]; for (int i = 0; i < values.length; i++) { synchronized (this) { values[i] = measurements[i]; } } return new Snapshot(values); } }
@Override public Snapshot getSnapshot() { final long[] values = new long[size()]; for (int i = 0; i < values.length; i++) { synchronized (this) { values[i] = measurements[i]; } } return new Snapshot(values); } }
@Override public Snapshot getSnapshot() { final int s = size(); final List<Long> copy = new ArrayList<Long>(s); for (int i = 0; i < s; i++) { copy.add(values.get(i)); } return new Snapshot(copy); } }
@Override public Snapshot getSnapshot() { final int s = size(); final List<Long> copy = new ArrayList<Long>(s); for (int i = 0; i < s; i++) { copy.add(values.get(i)); } return new Snapshot(copy); } }
@Override public Snapshot getSnapshot() { trim(); return new Snapshot(measurements.values()); }
@Override public Snapshot getSnapshot() { trim(); return new Snapshot(measurements.values()); }
@Override public Snapshot getSnapshot() { lockForRegularUsage(); try { return new Snapshot(values.values()); } finally { unlockForRegularUsage(); } }
@Override public Snapshot getSnapshot() { lockForRegularUsage(); try { return new Snapshot(values.values()); } finally { unlockForRegularUsage(); } }
@ReadingConverter public class SnapshotReadingConverter implements Converter<DBObject, Snapshot> { @Override public Snapshot convert(DBObject source) { long id = (Long) source.get("_id"); String description = (String) source.get("description"); boolean active = (Boolean) source.get("active"); boolean billable = false; if (source.get("billable") != null) { billable = (Boolean) source.get("billable"); } return new Snapshot(id, description, active, billable); } }