public CommBufferSizeStats() { commReadBufferSizeBytes = new MutableLong(0); commWriteBufferSizeBytes = new MutableLong(0); }
private void incrementCounter(K counter) { emitted++; MutableLong ml = counters.get(counter); if (ml == null) { if (counters.size() >= maxCounters) { // no need to store this counter in the map and get() it... just use instance variable tooMany++; } else { // we have never seen this key before, check if its too long if (encoder.apply(counter).length() >= maxCounterKeyLen) { tooLong++; } else { counters.put(copier.apply(counter), new MutableLong(1)); } } } else { // using mutable long allows calling put() to be avoided ml.increment(); } }
public LocalityGroupMetadata(String name, Set<ByteSequence> cfset, int indexBlockSize, BCFile.Writer bfw) { this.name = name; isDefaultLG = false; columnFamilies = new HashMap<>(); for (ByteSequence cf : cfset) { columnFamilies.put(cf, new MutableLong(0)); } indexWriter = new MultiLevelIndex.BufferedWriter( new MultiLevelIndex.Writer(bfw, indexBlockSize)); }
LocalityGroupMap(Map<String,Set<ByteSequence>> groups, boolean useNativeMap) { this.groupFams = new PreAllocatedArray<>(groups.size()); this.maps = new SimpleMap[groups.size() + 1]; this.partitioned = new PreAllocatedArray<>(groups.size() + 1); for (int i = 0; i < maps.length; i++) { maps[i] = newMap(useNativeMap); } int count = 0; for (Set<ByteSequence> cfset : groups.values()) { HashMap<ByteSequence,MutableLong> map = new HashMap<>(); for (ByteSequence bs : cfset) map.put(bs, new MutableLong(1)); this.groupFams.set(count++, map); } partitioner = new LocalityGroupUtil.Partitioner(this.groupFams); for (int i = 0; i < partitioned.length; i++) { partitioned.set(i, new ArrayList<>()); } }
long count = in.readLong(); columnFamilies.put(new ArrayByteSequence(cf), new MutableLong(count));
return; count = new MutableLong(0); columnFamilies.put(new ArrayByteSequence(cf.getBackingArray(), cf.offset(), cf.length()), count);
@Override protected MutableLong initialValue() { return new MutableLong(); } }
@Override protected MutableLong initialValue() { return new MutableLong(); } }
MutableLong cmid = new MutableLong(0);
protected MutableLong currentTimeMutableLong() { return new MutableLong(System.currentTimeMillis()); }
public ScanSessionStats() { timers = new EnumMap<>(TIMERS.class); mergedTimers = new EnumMap<>(TIMERS.class); for (TIMERS timer : TIMERS.values()) { timers.put(timer, new StopWatch()); mergedTimers.put(timer, new MutableLong()); } keysSeen = new MutableLong(); }
@Override public void setup(OperatorContext context) { this.context = context; commandCounters.setCounter(CommandCounters.ADD, new MutableLong()); commandCounters.setCounter(CommandCounters.ADD_RANGE, new MutableLong()); commandCounters.setCounter(CommandCounters.DELETE, new MutableLong()); commandCounters.setCounter(CommandCounters.CLEAR, new MutableLong()); }
public class Facebook { private MutableLong id = new MutableLong(); public Long getId() { return id.longValue(); } public void setId(Long id) { this.id.setValue(id); } public MutableLong getIdAsMutableLong() { return id; } private Collection<MyFriends> myFriends = new ArrayList<MyFriends>(); public Collection<MyFriends> getMyFriends() { return myFriends; } public void setMyFriends(Collection<MyFriends> myFriends) { this.myFriends = myFriends; } /** * add convenience method */ public void addFriend(Facebook myFriendFacebook) { myFriends.add(new MyFriends(this, myFriendFacebook)); } }
public ScanSessionStats merge(ScanSessionStats other) { for (TIMERS timer : mergedTimers.keySet()) { MutableLong timerValue = mergedTimers.get(timer); if (null == timerValue) { timerValue = new MutableLong(0); } long otherTimer = other.getValue(timer); timerValue.add(otherTimer); } return this; }
@Override public void setup(Context.OperatorContext context) { operatorId = context.getId(); LOG.debug("{}: partition keys {} mask {}", operatorId, partitionKeys, partitionMask); this.context = context; counters.setCounter(ReaderCounterKeys.BLOCKS, new MutableLong()); counters.setCounter(ReaderCounterKeys.RECORDS, new MutableLong()); counters.setCounter(ReaderCounterKeys.BYTES, new MutableLong()); counters.setCounter(ReaderCounterKeys.TIME, new MutableLong()); sleepTimeMillis = context.getValue(Context.OperatorContext.SPIN_MILLIS); }
MutableLong size = new MutableLong(); Files.walkFileTree(directoryPath, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { size.add(attrs.size()); } }
protected Number convertToNumber(Object o) { if (o == null) { return null; } else if (o instanceof MutableDouble || o instanceof MutableLong) { return (Number)o; } else if (o instanceof Double || o instanceof Float) { return new MutableDouble((Number)o); } else if (o instanceof Number) { return new MutableLong((Number)o); } else { return new MutableDouble(o.toString()); } }
@Override public void setup(OperatorContext context) { this.context = context; spinMillis = context.getValue(OperatorContext.SPIN_MILLIS); counters.setCounter(CounterKeys.RECEIVED, new MutableLong()); counters.setCounter(CounterKeys.REDELIVERED, new MutableLong()); windowDataManager.setup(context); }
public LocalityGroupMetadata(String name, Set<ByteSequence> cfset, int indexBlockSize, BlockFileWriter bfw) { this.name = name; isDefaultLG = false; columnFamilies = new HashMap<>(); for (ByteSequence cf : cfset) { columnFamilies.put(cf, new MutableLong(0)); } indexWriter = new MultiLevelIndex.BufferedWriter( new MultiLevelIndex.Writer(bfw, indexBlockSize)); }
private long updateTimestamps() { MutableLong ts = new MutableLong(Long.MAX_VALUE); for (Attribute<?> attribute : getAttributes()) { mergeTimestamps(attribute, ts); } return ts.longValue(); }