/** * Compares this object to the specified object. The result is <code>true</code> if and only if the argument * is not <code>null</code> and is a <code>MutableLong</code> object that contains the same <code>long</code> * value as this object. * * @param obj the object to compare with, null returns false * @return <code>true</code> if the objects are the same; <code>false</code> otherwise. */ public boolean equals(Object obj) { if (obj instanceof MutableLong) { return value == ((MutableLong) obj).longValue(); } return false; }
/** * Gets this mutable as an instance of Long. * * @return a Long instance containing the value from this mutable, never null */ public Long toLong() { return new Long(longValue()); }
@JmxGetter(name = "commReadBufferSize", description = "total amount of memory consumed by all the communication read buffers, in bytes") public final double getCommReadBufferSize() { long sum = 0; for(NioSelectorManager manager: selectorManagers) { sum += manager.getCommBufferSizeStats().getCommReadBufferSizeTracker().longValue(); } return sum; }
@JmxGetter(name = "commWriteBufferSize", description = "total amount of memory consumed by all the communication write buffers, in bytes") public final double getCommWriteBufferSize() { long sum = 0; for(NioSelectorManager manager: selectorManagers) { sum += manager.getCommBufferSizeStats().getCommWriteBufferSizeTracker().longValue(); } return sum; } }
public LocalityGroupContext(LocalityGroup[] groups) { this.groups = Collections.unmodifiableList(Arrays.asList(groups)); this.groupByCf = new HashMap<>(); LocalityGroup foundDefault = null; for (LocalityGroup group : groups) { if (group.isDefaultLocalityGroup && group.columnFamilies == null) { if (foundDefault != null) { throw new IllegalStateException("Found multiple default locality groups"); } foundDefault = group; } else { for (Entry<ByteSequence,MutableLong> entry : group.columnFamilies.entrySet()) { if (entry.getValue().longValue() > 0) { if (groupByCf.containsKey(entry.getKey())) { throw new IllegalStateException("Found the same cf in multiple locality groups"); } groupByCf.put(entry.getKey(), group); } } } } defaultGroup = foundDefault; } }
@Override public void summarize(StatisticConsumer sc) { StringBuilder sb = new StringBuilder(COUNTER_STAT_PREFIX); for (Entry<K,MutableLong> entry : counters.entrySet()) { sb.setLength(COUNTER_STAT_PREFIX.length()); sb.append(encoder.apply(entry.getKey())); sc.accept(sb.toString(), entry.getValue().longValue()); } sc.accept(TOO_MANY_STAT, tooMany); sc.accept(TOO_LONG_STAT, tooLong); sc.accept(EMITTED_STAT, emitted); sc.accept(SEEN_STAT, seen); sc.accept(DELETES_IGNORED_STAT, deleted); } };
private void convertMutations(TabletServerMutations<QCMutation> mutations, Map<Long,CMK> cmidToCm, MutableLong cmid, Map<TKeyExtent,List<TConditionalMutation>> tmutations, CompressedIterators compressedIters) { for (Entry<KeyExtent,List<QCMutation>> entry : mutations.getMutations().entrySet()) { TKeyExtent tke = entry.getKey().toThrift(); ArrayList<TConditionalMutation> tcondMutaions = new ArrayList<>(); List<QCMutation> condMutations = entry.getValue(); for (QCMutation cm : condMutations) { TMutation tm = cm.toThrift(); List<TCondition> conditions = convertConditions(cm, compressedIters); cmidToCm.put(cmid.longValue(), new CMK(entry.getKey(), cm)); TConditionalMutation tcm = new TConditionalMutation(conditions, tm, cmid.longValue()); cmid.increment(); tcondMutaions.add(tcm); } tmutations.put(tke, tcondMutaions); } }
@Override public void write(DataOutput out) throws IOException { out.writeBoolean(isDefaultLG); if (!isDefaultLG) { out.writeUTF(name); } if (isDefaultLG && columnFamilies == null) { // only expect null when default LG, otherwise let a NPE occur out.writeInt(-1); } else { out.writeInt(columnFamilies.size()); for (Entry<ByteSequence,MutableLong> entry : columnFamilies.entrySet()) { out.writeInt(entry.getKey().length()); out.write(entry.getKey().getBackingArray(), entry.getKey().offset(), entry.getKey().length()); out.writeLong(entry.getValue().longValue()); } } out.writeBoolean(firstKey != null); if (firstKey != null) firstKey.write(out); indexWriter.close(out); }
/** * Compares this object to the specified object. The result is <code>true</code> if and only if the argument * is not <code>null</code> and is a <code>MutableLong</code> object that contains the same <code>long</code> * value as this object. * * @param obj the object to compare with, null returns false * @return <code>true</code> if the objects are the same; <code>false</code> otherwise. */ public boolean equals(Object obj) { if (obj instanceof MutableLong) { return value == ((MutableLong) obj).longValue(); } return false; }
/** * Gets this mutable as an instance of Long. * * @return a Long instance containing the value from this mutable, never null */ public Long toLong() { return new Long(longValue()); }
/** * Gets this mutable as an instance of Long. * * @return a Long instance containing the value from this mutable, never null */ public Long toLong() { return new Long(longValue()); }
/** * Gets this mutable as an instance of Long. * * @return a Long instance containing the value from this mutable, never null */ public Long toLong() { return new Long(longValue()); }
/** * Gets this mutable as an instance of Long. * * @return a Long instance containing the value from this mutable, never null */ public Long toLong() { return new Long(longValue()); }
/** * Gets this mutable as an instance of Long. * * @return a Long instance containing the value from this mutable, never null */ public Long toLong() { return new Long(longValue()); }
@Override public void write(final MutableLong a, final DataOutput dos) throws IOException { long x = a.longValue(); while ((x & ~0x7FL) != 0) { dos.writeByte((int)(x | 0x80)); x >>>= 7; } dos.writeByte((int)x); }
/** * @return the wait time = rate^(num_failures) * minTime */ public long waitTime() { return waitTime.get().longValue(); }
@Override public long nextLong() { return iterator.next().longValue(); } }, 0, true);
/** * @return the wait time = rate^(num_failures) * minTime */ public long waitTime() { return waitTime.get().longValue(); }
protected void updateExpirationTimeSuggestion() { long now = System.currentTimeMillis(); long diff = expirationTimeSuggestion.longValue() - now; long max = getMaxInactiveIntervalMillis(); if (diff < (max/2)) { resetExpirationTimeSuggestion(); } }
private long updateTimestamps() { MutableLong ts = new MutableLong(Long.MAX_VALUE); for (Attribute<?> attribute : getAttributes()) { mergeTimestamps(attribute, ts); } return ts.longValue(); }