@Override public boolean accumulate(ConnectionState other) { if (other instanceof ConnectionCloseState) { ConnectionCloseState otherState = (ConnectionCloseState)other; if (this.closeConnectionIds == null) { this.closeConnectionIds = new TLongArrayList(); this.closeConnectionIds.add(this.closeConnectionId); } if (otherState.closeConnectionIds == null) { this.closeConnectionIds.add(otherState.closeConnectionId); } else { this.closeConnectionIds.add(otherState.closeConnectionIds); } return true; } return false; }
@Override public int numChanges() { if (this.closeConnectionIds != null) { return this.closeConnectionIds.size(); } return 1; }
/** * Sheds any excess capacity above and beyond the current size of * the list. */ public void trimToSize() { if (_data.length > size()) { long[] tmp = new long[size()]; toNativeArray(tmp, 0, tmp.length); _data = tmp; } }
TLongArrayList leftovers; while (mergeRuns.size() > maxMergeRuns) subset = new TLongArrayList(maxMergeRuns); leftovers = new TLongArrayList(mergeRuns.size() - maxMergeRuns); for (int i = 0; i < mergeRuns.size(); i++) long containerId = mergeRuns.getQuick(i); if (subset.size() < maxMergeRuns) subset.add(containerId); else leftovers.add(containerId); mergeRuns.add(id); for (int i = 0; i < subset.size(); i++) long containerId = subset.getQuick(i); rawTran.dropStreamContainer(segmentId, containerId);
/** Get rid of the merge runs, if there are any. Must not cause any errors because it's called during error processing. **/ void dropMergeRuns(TransactionManager tran) { if (mergeRuns != null) { //Enumeration e = mergeRuns.elements(); try { Transaction rawTran = tran.getRawStoreXact(); long segmentId = StreamContainerHandle.TEMPORARY_SEGMENT; for (int i = 0; i < mergeRuns.size(); i++) { //long containerId = ((Long) e.nextElement()).longValue(); long containerId = mergeRuns.getQuick(i); rawTran.dropStreamContainer(segmentId, containerId); } } catch (StandardException se) { // Ignore problems with dropping, worst case // the raw store will clean up at reboot. } mergeRuns = null; } }
ikey.writeKeyBytes(dos); TLongArrayList entryKeyIds = (TLongArrayList)value; int numKeyIds = entryKeyIds.size(); assert numKeyIds > 0; InternalDataSerializer.writeUnsignedVL(numKeyIds, dos); logger.info(LocalizedStrings.DEBUG, "OplogIndex#writeIRFRecords: " + "writing actual index record with index key: " + key + " list of oplogEntryIds: " + entryKeyIds.toString()); InternalDataSerializer.writeUnsignedVL(entryKeyIds.getQuick(0), dos); } else { entryKeyIds.sort(); long previousValue = 0; for (int index = 0; index < numKeyIds; index++) { long currValue = entryKeyIds.getQuick(index); if (previousValue == 0) { previousValue = currValue;
/** * Adds a subset of the values in the TLongArrayList <tt>vals</tt> to the * end of the list, in order. * * @param vals a <code>TLongArrayList</code> value * @param offset the offset at which to start copying * @param length the number of values to copy. */ public void add(TLongArrayList vals, int offset, int length) { add(vals._data, offset, length); }
@Override public Object create(Object key, Object params) { if (hasOffHeap) { // Snapshot the key bytes, as the offheap value bytes used as index // key would be // released , before the data is dumped in the irf. // Since a newTLongArrayList is created, implying this index key will // be used in the dumping code // Check if snap shot is needed in case of only load ((SortedIndexKey)key).snapshotKeyFromValue(); } return new TLongArrayList(2); } };
/** * Copies a slice of the list into a native array. * * @param offset the offset at which to start copying * @param len the number of values to copy. * @return an <code>long[]</code> value */ public long[] toNativeArray(int offset, int len) { long[] rv = new long[len]; toNativeArray(rv, offset, len); return rv; }
/** * Inserts <tt>value</tt> into the list at <tt>offset</tt>. All * values including and to the right of <tt>offset</tt> are shifted * to the right. * * @param offset an <code>int</code> value * @param value an <code>long</code> value */ public void insert(int offset, long value) { if (offset == _pos) { add(value); return; } ensureCapacity(_pos + 1); // shift right System.arraycopy(_data, offset, _data, offset + 1, _pos - offset); // insert _data[offset] = value; _pos++; }
@Override public String toString() { return this.getClass().getName() + ": " + (this.closeConnectionIds != null ? this.closeConnectionIds .toString() : this.closeConnectionId); } }
if (this.singleUUIDList != null) { this.currentRow.getColumn(colPos).setValue( this.singleUUIDList.get(this.iterPos));
TLongArrayList leftovers; while (mergeRuns.size() > maxMergeRuns) subset = new TLongArrayList(maxMergeRuns); leftovers = new TLongArrayList(mergeRuns.size() - maxMergeRuns); for (int i = 0; i < mergeRuns.size(); i++) long containerId = mergeRuns.getQuick(i); if (subset.size() < maxMergeRuns) subset.add(containerId); else leftovers.add(containerId); mergeRuns.add(id); for (int i = 0; i < subset.size(); i++) long containerId = subset.getQuick(i); rawTran.dropStreamContainer(segmentId, containerId);
/** Get rid of the merge runs, if there are any. Must not cause any errors because it's called during error processing. **/ void dropMergeRuns(TransactionManager tran) { if (mergeRuns != null) { //Enumeration e = mergeRuns.elements(); try { Transaction rawTran = tran.getRawStoreXact(); long segmentId = StreamContainerHandle.TEMPORARY_SEGMENT; for (int i = 0; i < mergeRuns.size(); i++) { //long containerId = ((Long) e.nextElement()).longValue(); long containerId = mergeRuns.getQuick(i); rawTran.dropStreamContainer(segmentId, containerId); } } catch (StandardException se) { // Ignore problems with dropping, worst case // the raw store will clean up at reboot. } mergeRuns = null; } }
/** * Adds the values in the TLongArrayList <tt>vals</tt> to the end of the * list, in order. * * @param vals a <code>TLongArrayList</code> value */ public void add(TLongArrayList vals) { add(vals._data, 0, vals._pos); }
this.singleUUIDList = new TLongArrayList(); this.uuidList = null;
/** * Copies the contents of the list into a native array. * * @return an <code>long[]</code> value */ public long[] toNativeArray() { return toNativeArray(0, _pos); }