org.apache.flink.runtime.rest.handler.async.AsynchronousOperationInfo Java Examples
The following examples show how to use
org.apache.flink.runtime.rest.handler.async.AsynchronousOperationInfo.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RestClusterClientTest.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
@Override protected CompletableFuture<AsynchronousOperationResult<AsynchronousOperationInfo>> handleRequest(@Nonnull HandlerRequest<EmptyRequestBody, SavepointDisposalStatusMessageParameters> request, @Nonnull DispatcherGateway gateway) throws RestHandlerException { final TriggerId actualTriggerId = request.getPathParameter(TriggerIdPathParameter.class); if (actualTriggerId.equals(triggerId)) { final OptionalFailure<AsynchronousOperationInfo> nextResponse = responses.poll(); if (nextResponse != null) { if (nextResponse.isFailure()) { throw new RestHandlerException("Failure", HttpResponseStatus.BAD_REQUEST, nextResponse.getFailureCause()); } else { return CompletableFuture.completedFuture(AsynchronousOperationResult.completed(nextResponse.getUnchecked())); } } else { throw new AssertionError(); } } else { throw new AssertionError(); } }
Example #2
Source File: RestClusterClientTest.java From flink with Apache License 2.0 | 6 votes |
@Override protected CompletableFuture<AsynchronousOperationResult<AsynchronousOperationInfo>> handleRequest(@Nonnull HandlerRequest<EmptyRequestBody, SavepointDisposalStatusMessageParameters> request, @Nonnull DispatcherGateway gateway) throws RestHandlerException { final TriggerId actualTriggerId = request.getPathParameter(TriggerIdPathParameter.class); if (actualTriggerId.equals(triggerId)) { final OptionalFailure<AsynchronousOperationInfo> nextResponse = responses.poll(); if (nextResponse != null) { if (nextResponse.isFailure()) { throw new RestHandlerException("Failure", HttpResponseStatus.BAD_REQUEST, nextResponse.getFailureCause()); } else { return CompletableFuture.completedFuture(AsynchronousOperationResult.completed(nextResponse.getUnchecked())); } } else { throw new AssertionError(); } } else { throw new AssertionError(); } }
Example #3
Source File: RestClusterClientTest.java From flink with Apache License 2.0 | 6 votes |
@Override protected CompletableFuture<AsynchronousOperationResult<AsynchronousOperationInfo>> handleRequest(@Nonnull HandlerRequest<EmptyRequestBody, SavepointDisposalStatusMessageParameters> request, @Nonnull DispatcherGateway gateway) throws RestHandlerException { final TriggerId actualTriggerId = request.getPathParameter(TriggerIdPathParameter.class); if (actualTriggerId.equals(triggerId)) { final OptionalFailure<AsynchronousOperationInfo> nextResponse = responses.poll(); if (nextResponse != null) { if (nextResponse.isFailure()) { throw new RestHandlerException("Failure", HttpResponseStatus.BAD_REQUEST, nextResponse.getFailureCause()); } else { return CompletableFuture.completedFuture(AsynchronousOperationResult.completed(nextResponse.getUnchecked())); } } else { throw new AssertionError(); } } else { throw new AssertionError(); } }
Example #4
Source File: RestClusterClient.java From flink with Apache License 2.0 | 5 votes |
@Override public CompletableFuture<Acknowledge> disposeSavepoint(String savepointPath) { final SavepointDisposalRequest savepointDisposalRequest = new SavepointDisposalRequest(savepointPath); final CompletableFuture<TriggerResponse> savepointDisposalTriggerFuture = sendRequest( SavepointDisposalTriggerHeaders.getInstance(), savepointDisposalRequest); final CompletableFuture<AsynchronousOperationInfo> savepointDisposalFuture = savepointDisposalTriggerFuture.thenCompose( (TriggerResponse triggerResponse) -> { final TriggerId triggerId = triggerResponse.getTriggerId(); final SavepointDisposalStatusHeaders savepointDisposalStatusHeaders = SavepointDisposalStatusHeaders.getInstance(); final SavepointDisposalStatusMessageParameters savepointDisposalStatusMessageParameters = savepointDisposalStatusHeaders.getUnresolvedMessageParameters(); savepointDisposalStatusMessageParameters.triggerIdPathParameter.resolve(triggerId); return pollResourceAsync( () -> sendRequest( savepointDisposalStatusHeaders, savepointDisposalStatusMessageParameters)); }); return savepointDisposalFuture.thenApply( (AsynchronousOperationInfo asynchronousOperationInfo) -> { if (asynchronousOperationInfo.getFailureCause() == null) { return Acknowledge.get(); } else { throw new CompletionException(asynchronousOperationInfo.getFailureCause()); } }); }
Example #5
Source File: RestClusterClient.java From flink with Apache License 2.0 | 5 votes |
@Override public CompletableFuture<Acknowledge> disposeSavepoint(String savepointPath) { final SavepointDisposalRequest savepointDisposalRequest = new SavepointDisposalRequest(savepointPath); final CompletableFuture<TriggerResponse> savepointDisposalTriggerFuture = sendRequest( SavepointDisposalTriggerHeaders.getInstance(), savepointDisposalRequest); final CompletableFuture<AsynchronousOperationInfo> savepointDisposalFuture = savepointDisposalTriggerFuture.thenCompose( (TriggerResponse triggerResponse) -> { final TriggerId triggerId = triggerResponse.getTriggerId(); final SavepointDisposalStatusHeaders savepointDisposalStatusHeaders = SavepointDisposalStatusHeaders.getInstance(); final SavepointDisposalStatusMessageParameters savepointDisposalStatusMessageParameters = savepointDisposalStatusHeaders.getUnresolvedMessageParameters(); savepointDisposalStatusMessageParameters.triggerIdPathParameter.resolve(triggerId); return pollResourceAsync( () -> sendRequest( savepointDisposalStatusHeaders, savepointDisposalStatusMessageParameters)); }); return savepointDisposalFuture.thenApply( (AsynchronousOperationInfo asynchronousOperationInfo) -> { if (asynchronousOperationInfo.getFailureCause() == null) { return Acknowledge.get(); } else { throw new CompletionException(asynchronousOperationInfo.getFailureCause()); } }); }
Example #6
Source File: RestClusterClient.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override public CompletableFuture<Acknowledge> disposeSavepoint(String savepointPath) { final SavepointDisposalRequest savepointDisposalRequest = new SavepointDisposalRequest(savepointPath); final CompletableFuture<TriggerResponse> savepointDisposalTriggerFuture = sendRequest( SavepointDisposalTriggerHeaders.getInstance(), savepointDisposalRequest); final CompletableFuture<AsynchronousOperationInfo> savepointDisposalFuture = savepointDisposalTriggerFuture.thenCompose( (TriggerResponse triggerResponse) -> { final TriggerId triggerId = triggerResponse.getTriggerId(); final SavepointDisposalStatusHeaders savepointDisposalStatusHeaders = SavepointDisposalStatusHeaders.getInstance(); final SavepointDisposalStatusMessageParameters savepointDisposalStatusMessageParameters = savepointDisposalStatusHeaders.getUnresolvedMessageParameters(); savepointDisposalStatusMessageParameters.triggerIdPathParameter.resolve(triggerId); return pollResourceAsync( () -> sendRequest( savepointDisposalStatusHeaders, savepointDisposalStatusMessageParameters)); }); return savepointDisposalFuture.thenApply( (AsynchronousOperationInfo asynchronousOperationInfo) -> { if (asynchronousOperationInfo.getFailureCause() == null) { return Acknowledge.get(); } else { throw new CompletionException(asynchronousOperationInfo.getFailureCause()); } }); }
Example #7
Source File: RestClusterClient.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override public CompletableFuture<Acknowledge> rescaleJob(JobID jobId, int newParallelism) { final RescalingTriggerHeaders rescalingTriggerHeaders = RescalingTriggerHeaders.getInstance(); final RescalingTriggerMessageParameters rescalingTriggerMessageParameters = rescalingTriggerHeaders.getUnresolvedMessageParameters(); rescalingTriggerMessageParameters.jobPathParameter.resolve(jobId); rescalingTriggerMessageParameters.rescalingParallelismQueryParameter.resolve(Collections.singletonList(newParallelism)); final CompletableFuture<TriggerResponse> rescalingTriggerResponseFuture = sendRequest( rescalingTriggerHeaders, rescalingTriggerMessageParameters); final CompletableFuture<AsynchronousOperationInfo> rescalingOperationFuture = rescalingTriggerResponseFuture.thenCompose( (TriggerResponse triggerResponse) -> { final TriggerId triggerId = triggerResponse.getTriggerId(); final RescalingStatusHeaders rescalingStatusHeaders = RescalingStatusHeaders.getInstance(); final RescalingStatusMessageParameters rescalingStatusMessageParameters = rescalingStatusHeaders.getUnresolvedMessageParameters(); rescalingStatusMessageParameters.jobPathParameter.resolve(jobId); rescalingStatusMessageParameters.triggerIdPathParameter.resolve(triggerId); return pollResourceAsync( () -> sendRequest( rescalingStatusHeaders, rescalingStatusMessageParameters)); }); return rescalingOperationFuture.thenApply( (AsynchronousOperationInfo asynchronousOperationInfo) -> { if (asynchronousOperationInfo.getFailureCause() == null) { return Acknowledge.get(); } else { throw new CompletionException(asynchronousOperationInfo.getFailureCause()); } }); }
Example #8
Source File: RescalingHandlers.java From flink with Apache License 2.0 | 4 votes |
@Override protected AsynchronousOperationInfo operationResultResponse(Acknowledge operationResult) { throw new UnsupportedOperationException(); }
Example #9
Source File: RescalingHandlers.java From flink with Apache License 2.0 | 4 votes |
@Override protected AsynchronousOperationInfo exceptionalOperationResultResponse(Throwable throwable) { throw new UnsupportedOperationException(); }
Example #10
Source File: RescalingStatusHeaders.java From flink with Apache License 2.0 | 4 votes |
@Override protected Class<AsynchronousOperationInfo> getValueClass() { return AsynchronousOperationInfo.class; }
Example #11
Source File: RescalingHandlers.java From flink with Apache License 2.0 | 4 votes |
@Override public CompletableFuture<AsynchronousOperationResult<AsynchronousOperationInfo>> handleRequest(@Nonnull final HandlerRequest<EmptyRequestBody, RescalingStatusMessageParameters> request, @Nonnull final RestfulGateway gateway) throws RestHandlerException { throw featureDisabledException(); }
Example #12
Source File: SavepointDisposalHandlers.java From flink with Apache License 2.0 | 4 votes |
@Override protected AsynchronousOperationInfo operationResultResponse(Acknowledge operationResult) { return AsynchronousOperationInfo.complete(); }
Example #13
Source File: SavepointDisposalHandlers.java From flink with Apache License 2.0 | 4 votes |
@Override protected AsynchronousOperationInfo exceptionalOperationResultResponse(Throwable throwable) { return AsynchronousOperationInfo.completeExceptional(new SerializedThrowable(throwable)); }
Example #14
Source File: ClusterDataSetDeleteHandlers.java From flink with Apache License 2.0 | 4 votes |
@Override protected AsynchronousOperationInfo operationResultResponse(Void ignored) { return AsynchronousOperationInfo.complete(); }
Example #15
Source File: ClusterDataSetDeleteHandlers.java From flink with Apache License 2.0 | 4 votes |
@Override protected AsynchronousOperationInfo exceptionalOperationResultResponse(Throwable throwable) { return AsynchronousOperationInfo.completeExceptional(new SerializedThrowable(throwable)); }
Example #16
Source File: SavepointDisposalStatusHeaders.java From flink with Apache License 2.0 | 4 votes |
@Override public Class<AsynchronousOperationInfo> getValueClass() { return AsynchronousOperationInfo.class; }
Example #17
Source File: ClusterDataSetDeleteStatusHeaders.java From flink with Apache License 2.0 | 4 votes |
@Override public Class<AsynchronousOperationInfo> getValueClass() { return AsynchronousOperationInfo.class; }
Example #18
Source File: RescalingStatusHeaders.java From flink with Apache License 2.0 | 4 votes |
@Override public Class<AsynchronousOperationInfo> getValueClass() { return AsynchronousOperationInfo.class; }
Example #19
Source File: RestClusterClientTest.java From flink with Apache License 2.0 | 4 votes |
private TestSavepointDisposalStatusHandler(OptionalFailure<AsynchronousOperationInfo>... responses) { super(SavepointDisposalStatusHeaders.getInstance()); this.responses = new ArrayDeque<>(Arrays.asList(responses)); }
Example #20
Source File: RestClusterClientTest.java From flink with Apache License 2.0 | 4 votes |
private TestSavepointDisposalStatusHandler(OptionalFailure<AsynchronousOperationInfo>... responses) { super(SavepointDisposalStatusHeaders.getInstance()); this.responses = new ArrayDeque<>(Arrays.asList(responses)); }
Example #21
Source File: SavepointDisposalStatusHeaders.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Override protected Class<AsynchronousOperationInfo> getValueClass() { return AsynchronousOperationInfo.class; }
Example #22
Source File: RescalingHandlers.java From flink with Apache License 2.0 | 4 votes |
@Override protected AsynchronousOperationInfo operationResultResponse(Acknowledge operationResult) { throw new UnsupportedOperationException(); }
Example #23
Source File: RescalingHandlers.java From flink with Apache License 2.0 | 4 votes |
@Override protected AsynchronousOperationInfo exceptionalOperationResultResponse(Throwable throwable) { throw new UnsupportedOperationException(); }
Example #24
Source File: RescalingHandlers.java From flink with Apache License 2.0 | 4 votes |
@Override public CompletableFuture<AsynchronousOperationResult<AsynchronousOperationInfo>> handleRequest(@Nonnull final HandlerRequest<EmptyRequestBody, RescalingStatusMessageParameters> request, @Nonnull final RestfulGateway gateway) throws RestHandlerException { throw featureDisabledException(); }
Example #25
Source File: SavepointDisposalHandlers.java From flink with Apache License 2.0 | 4 votes |
@Override protected AsynchronousOperationInfo operationResultResponse(Acknowledge operationResult) { return AsynchronousOperationInfo.complete(); }
Example #26
Source File: SavepointDisposalHandlers.java From flink with Apache License 2.0 | 4 votes |
@Override protected AsynchronousOperationInfo exceptionalOperationResultResponse(Throwable throwable) { return AsynchronousOperationInfo.completeExceptional(new SerializedThrowable(throwable)); }
Example #27
Source File: SavepointDisposalStatusHeaders.java From flink with Apache License 2.0 | 4 votes |
@Override protected Class<AsynchronousOperationInfo> getValueClass() { return AsynchronousOperationInfo.class; }
Example #28
Source File: RestClusterClientTest.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
private TestSavepointDisposalStatusHandler(OptionalFailure<AsynchronousOperationInfo>... responses) { super(SavepointDisposalStatusHeaders.getInstance()); this.responses = new ArrayDeque<>(Arrays.asList(responses)); }
Example #29
Source File: RescalingStatusHeaders.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Override protected Class<AsynchronousOperationInfo> getValueClass() { return AsynchronousOperationInfo.class; }
Example #30
Source File: RescalingHandlers.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Override protected AsynchronousOperationInfo operationResultResponse(Acknowledge operationResult) { return AsynchronousOperationInfo.complete(); }