Creates a snapshot of this accumulator registry.
@return a serialized accumulator map
177085
public AccumulatorSnapshot getSnapshot() {
		try {
			return new AccumulatorSnapshot(jobID, taskID, userAccumulators);
		} catch (Throwable e) {
			LOG.warn("Failed to serialize accumulators for task.", e);
			return null;
		}
	}
1295547
public synchronized TimeCounter snapshot(boolean reset) {
		TimeCounter s = new TimeCounter();

		if (reset) {
			s.count.set(count.getAndSet(0));
			s.total.set(total.getAndSet(0));
			s.min.set(min.getAndSet(0));
			s.max.set(max.getAndSet(0));
		} else {
			s.count.set(count.get());
			s.total.set(total.get());
			s.min.set(min.get());
			s.max.set(max.get());
		}
		return s;
	}
294702
public UserManagedCacheBuilder<K, V, T> withKeySerializingCopier() {
    UserManagedCacheBuilder<K, V, T> otherBuilder = new UserManagedCacheBuilder<>(this);
    otherBuilder.keyCopier = null;
    otherBuilder.useKeySerializingCopier = true;
    return otherBuilder;
  }
1358003
public String serialize() {
        JaxbJsonSerializer<CreateSnapshotBridgeParameters> serializer =
            new JaxbJsonSerializer<>(CreateSnapshotBridgeParameters.class);
        try {
            return serializer.serialize(this);
        } catch (IOException e) {
            throw new SnapshotDataException(
                "Unable to create task result due to: " + e.getMessage());
        }
    }
966732
public static Pair<Grouper<RowBasedKey>, Accumulator<AggregateResult, Row>> createGrouperAccumulatorPair(
      final GroupByQuery query,
      final boolean isInputRaw,
      final Map<String, ValueType> rawInputRowSignature,
      final GroupByQueryConfig config,
      final Supplier<ByteBuffer> bufferSupplier,
      final LimitedTemporaryStorage temporaryStorage,
      final ObjectMapper spillMapper,
      final AggregatorFactory[] aggregatorFactories,
      final int mergeBufferSize
  )
  {
    return createGrouperAccumulatorPair(
        query,
        isInputRaw,
        rawInputRowSignature,
        config,
        bufferSupplier,
        null,
        SINGLE_THREAD_CONCURRENCY_HINT,
        temporaryStorage,
        spillMapper,
        aggregatorFactories,
        null,
        UNKNOWN_THREAD_PRIORITY,
        false,
        UNKNOWN_TIMEOUT,
        mergeBufferSize
    );
  }
645181
public HashMap<StreamShardMetadata, SequenceNumber> snapshotState() {
		// this method assumes that the checkpoint lock is held
		assert Thread.holdsLock(checkpointLock);

		HashMap<StreamShardMetadata, SequenceNumber> stateSnapshot = new HashMap<>();
		for (KinesisStreamShardState shardWithState : subscribedShardsState) {
			stateSnapshot.put(shardWithState.getStreamShardMetadata(), shardWithState.getLastProcessedSequenceNum());
		}
		return stateSnapshot;
	}
582387
@Override
	public Map<String, SerializedValue<OptionalFailure<Object>>> getAccumulatorsSerialized() {
		return aggregateUserAccumulators()
			.entrySet()
			.stream()
			.collect(Collectors.toMap(
				Map.Entry::getKey,
				entry -> serializeAccumulator(entry.getKey(), entry.getValue())));
	}
1213652
AbstractMap.SimpleImmutableEntry<K,V> createSnapshot() {
            Object v = value;
            if (v == null || v == sentinel() || v == BASE_HEADER)
                return null;
            @SuppressWarnings("unchecked") V vv = (V)v;
            return new AbstractMap.SimpleImmutableEntry<K,V>(key, vv);
        }
134919
Map<String, Object> serialize() {

		final Map<String, Object> map = new TreeMap<>();

		map.put(JsonSchema.KEY_DEFINITIONS, typeDefinitions.serialize());
		map.put(JsonSchema.KEY_METHODS, globalMethods.serialize());
		map.put(JsonSchema.KEY_ID, getId());

		return map;
	}
1350595
public Object[] toArrayCached() {
        Object[] readCacheArray = generatedCacheMap.values().toArray();
        Object[] writeCacheArray = resultSetCacheMap.values().toArray();

        Object[] combinedCacheArray = new Object[readCacheArray.length + writeCacheArray.length];

        System.arraycopy(readCacheArray, 0, combinedCacheArray, 0, readCacheArray.length);
        System.arraycopy(writeCacheArray, 0, combinedCacheArray, readCacheArray.length, writeCacheArray.length);

        return combinedCacheArray;
    }
51122
public static Map<String, OptionalFailure<Object>> toResultMap(Map<String, Accumulator<?, ?>> accumulators) {
		Map<String, OptionalFailure<Object>> resultMap = new HashMap<>();
		for (Map.Entry<String, Accumulator<?, ?>> entry : accumulators.entrySet()) {
			resultMap.put(entry.getKey(), wrapUnchecked(entry.getKey(), () -> entry.getValue().getLocalValue()));
		}
		return resultMap;
	}
1346435
private ObjectMapper createObjectMapper() {
        ObjectMapper mapper = new ObjectMapper();
        mapper.registerModule(new JodaModule());
        mapper.configure(SerializationFeature.INDENT_OUTPUT, true);
        return mapper;
    }
472450
public static <K,V> Map<K,V> asSynchronized(Map<K,V> self) {
        return Collections.synchronizedMap(self);
    }
811769
private static <K> LinkedHashMap<K, TypeSerializer<?>> restoreSerializers(LinkedHashMap<K, TypeSerializerSnapshot<?>> snapshotsMap) {
		final LinkedHashMap<K, TypeSerializer<?>> restoredSerializersMap = new LinkedHashMap<>(snapshotsMap.size());
		snapshotsMap.forEach((key, snapshot) -> restoredSerializersMap.put(key, snapshot.restoreSerializer()));
		return restoredSerializersMap;
	}
85059
CheckpointStatsHistory createSnapshot() {
		if (readOnly) {
			throw new UnsupportedOperationException("Can't create a snapshot of a read-only history.");
		}

		List<AbstractCheckpointStats> checkpointsHistory;
		Map<Long, AbstractCheckpointStats> checkpointsById;

		checkpointsById = new HashMap<>(checkpointsArray.length);

		if (maxSize == 0) {
			checkpointsHistory = Collections.emptyList();
		} else {
			AbstractCheckpointStats[] newCheckpointsArray = new AbstractCheckpointStats[checkpointsArray.length];

			System.arraycopy(checkpointsArray, nextPos, newCheckpointsArray, 0, checkpointsArray.length - nextPos);
			System.arraycopy(checkpointsArray, 0, newCheckpointsArray, checkpointsArray.length - nextPos, nextPos);

			checkpointsHistory = Arrays.asList(newCheckpointsArray);

			// reverse the order such that we start with the youngest checkpoint
			Collections.reverse(checkpointsHistory);

			for (AbstractCheckpointStats checkpoint : checkpointsHistory) {
				checkpointsById.put(checkpoint.getCheckpointId(), checkpoint);
			}
		}

		if (latestCompletedCheckpoint != null) {
			checkpointsById.put(latestCompletedCheckpoint.getCheckpointId(), latestCompletedCheckpoint);
		}

		if (latestFailedCheckpoint != null) {
			checkpointsById.put(latestFailedCheckpoint.getCheckpointId(), latestFailedCheckpoint);
		}

		if (latestSavepoint != null) {
			checkpointsById.put(latestSavepoint.getCheckpointId(), latestSavepoint);
		}

		return new CheckpointStatsHistory(
			true,
			maxSize,
			null,
			checkpointsHistory,
			checkpointsById,
			latestCompletedCheckpoint,
			latestFailedCheckpoint,
			latestSavepoint);
	}
539757
public static <K,V> Storage<K,V> createHashMapStorage(){
		return new Storage<K,V>(new MapStorageWrapper<K, V>(new HashMap<K, V>()));
	}
304243
public CompletableFuture<Void> snapshot() {
    RaftPartitionServer server = this.server;
    if (server != null) {
      return server.snapshot();
    }
    return CompletableFuture.completedFuture(null);
  }