public void pushBack(IN element) { Preconditions.checkState(pushBack == null, "Already contains an element that was pushed back. This indicates a programming error."); pushBack = element; } }
/** * Sets the part size above which a part file will have to roll. * @param size the allowed part size. */ public DefaultRollingPolicy.PolicyBuilder withMaxPartSize(final long size) { Preconditions.checkState(size > 0L); return new PolicyBuilder(size, rolloverInterval, inactivityInterval); }
/** * Sets the interval of allowed inactivity after which a part file will have to roll. * @param interval the allowed inactivity interval. */ public DefaultRollingPolicy.PolicyBuilder withInactivityInterval(final long interval) { Preconditions.checkState(interval > 0L); return new PolicyBuilder(partSize, rolloverInterval, interval); }
@Override protected NullableSerializer<T> createOuterSerializerWithNestedSerializers(TypeSerializer<?>[] nestedSerializers) { checkState(nullPaddingLength >= 0, "Negative padding size after serializer construction: %d", nullPaddingLength); final byte[] padding = (nullPaddingLength == 0) ? EMPTY_BYTE_ARRAY : new byte[nullPaddingLength]; TypeSerializer<T> nestedSerializer = (TypeSerializer<T>) nestedSerializers[0]; return new NullableSerializer<>(nestedSerializer, padding); }
private Set<String> generateNewTransactionalIds() { checkState(nextTransactionalIdHint != null, "nextTransactionalIdHint must be present for EXACTLY_ONCE"); Set<String> transactionalIds = transactionalIdsGenerator.generateIdsToUse(nextTransactionalIdHint.nextFreeTransactionalId); LOG.info("Generated new transactionalIds {}", transactionalIds); return transactionalIds; }
/** * Sets the max time a part file can stay open before having to roll. * @param interval the desired rollover interval. */ public DefaultRollingPolicy.PolicyBuilder withRolloverInterval(final long interval) { Preconditions.checkState(interval > 0L); return new PolicyBuilder(partSize, interval, inactivityInterval); }
@Override public void snapshotState(FunctionSnapshotContext context) throws Exception { Preconditions.checkState(this.checkpointedState != null, "The " + getClass().getSimpleName() + " state has not been properly initialized."); this.checkpointedState.clear(); this.checkpointedState.add(this.globalModificationTime); if (LOG.isDebugEnabled()) { LOG.debug("{} checkpointed {}.", getClass().getSimpleName(), globalModificationTime); } } }
@Override public void snapshotState(FunctionSnapshotContext context) throws Exception { Preconditions.checkState(this.checkpointedState != null, "The " + getClass().getSimpleName() + " has not been properly initialized."); this.checkpointedState.clear(); this.checkpointedState.add(this.numElementsEmitted); }
@Override public void snapshotState(FunctionSnapshotContext context) throws Exception { Preconditions.checkState(this.checkpointedState != null, "The " + getClass().getSimpleName() + " state has not been properly initialized."); this.checkpointedState.clear(); for (Long v : this.valuesToEmit) { this.checkpointedState.add(v); } }
public synchronized CompletableFuture<?> setExpectedRecord(long record) { checkState(!expectedRecord.isDone()); checkState(!recordsProcessed.isDone()); expectedRecord.complete(record); expectedRecordCounter = 0; return recordsProcessed; }
public Collection<String> read(String name) { List<String> content = filesContent.get(name); checkState(content != null, "Unknown file [%s]", name); List<String> result = new ArrayList<>(content); return result; }
@Override public final void writeSnapshot(DataOutputView out) throws IOException { checkState(serializer != null, "the prior serializer has not been set on this"); // write the snapshot for a non-updated serializer. // this mimics the previous behavior where the TypeSerializer was // Java-serialized, for backwards compatibility TypeSerializerSerializationUtil.writeSerializer(out, serializer); // now delegate to the snapshots own writing code write(out); }
public void snapshotStateForKeyGroup(DataOutputView stream, int keyGroupIdx) throws IOException { Preconditions.checkState(useLegacySynchronousSnapshots); InternalTimerServiceSerializationProxy<K> serializationProxy = new InternalTimerServiceSerializationProxy<>(this, keyGroupIdx); serializationProxy.write(stream); }
@Override public void snapshotState(FunctionSnapshotContext context) throws Exception { Preconditions.checkState(bucketStates != null && maxPartCountersState != null, "sink has not been initialized"); buckets.snapshotState( context.getCheckpointId(), bucketStates, maxPartCountersState); }
private synchronized void finishProcessingExpectedRecords() { checkState(expectedRecord.isDone()); checkState(!recordsProcessed.isDone()); recordsProcessed.complete(null); expectedRecord = new CompletableFuture<>(); recordsProcessed = new CompletableFuture<>(); }
private void awaitPendingPartsUpload() throws IOException { checkState(currentUploadInfo.getRemainingParts() == uploadsInProgress.size()); while (currentUploadInfo.getRemainingParts() > 0) { CompletableFuture<PartETag> next = uploadsInProgress.peekFirst(); PartETag nextPart = awaitPendingPartUploadToComplete(next); currentUploadInfo.registerCompletePart(nextPart); uploadsInProgress.removeFirst(); } }
private void putContent(String name, List<String> values) { List<String> content = filesContent.get(name); checkState(content != null, "Unknown file [%s]", name); if (!writable) { throw new NotWritableException(name); } content.addAll(values); }
@Override public EitherSerializer<L, R> restoreSerializer() { checkState(nestedSnapshot != null); return new EitherSerializer<>( nestedSnapshot.getRestoredNestedSerializer(0), nestedSnapshot.getRestoredNestedSerializer(1)); }
private ApplicationReport getOnlyApplicationReport() throws IOException, YarnException { final YarnClient yarnClient = getYarnClient(); checkState(yarnClient != null); final List<ApplicationReport> apps = yarnClient.getApplications(EnumSet.of(YarnApplicationState.RUNNING)); assertEquals(1, apps.size()); // Only one running return apps.get(0); }
private void waitForApplicationAttempt(final ApplicationId applicationId, final int attemptId) throws Exception { final YarnClient yarnClient = getYarnClient(); checkState(yarnClient != null, "yarnClient must be initialized"); waitUntilCondition(() -> { final ApplicationReport applicationReport = yarnClient.getApplicationReport(applicationId); return applicationReport.getCurrentApplicationAttemptId().getAttemptId() >= attemptId; }, Deadline.fromNow(TIMEOUT)); }