public final class SyncPutListener extends Object implements FlightClient.PutListener, AutoCloseable
Constructor and Description |
---|
SyncPutListener() |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
getResult()
Wait for the stream to finish on the server side.
|
boolean |
isCancelled()
Check if the call has been cancelled.
|
void |
onCompleted()
Indicate that the transmission is finished.
|
void |
onError(Throwable t)
Indicate an error to the client.
|
void |
onNext(PutResult val)
Called when a message from the server is received.
|
PutResult |
poll(long timeout,
TimeUnit unit)
Get the next message from the server, blocking for the specified amount of time until it is available.
|
PutResult |
read()
Get the next message from the server, blocking until it is available.
|
public PutResult read() throws InterruptedException, ExecutionException
InterruptedException
- if interrupted while waiting.ExecutionException
- if the server sent an error, or if there was an internal error.public PutResult poll(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException
InterruptedException
- if interrupted while waiting.ExecutionException
- if the server sent an error, or if there was an internal error.public void getResult()
FlightClient.PutListener
getResult
in interface FlightClient.PutListener
public void onNext(PutResult val)
FlightClient.PutListener
onNext
in interface FlightClient.PutListener
onNext
in interface FlightProducer.StreamListener<PutResult>
val
- The application metadata. This buffer will be reclaimed once onNext returns; you must retain a
reference to use it outside this method.public void onError(Throwable t)
FlightProducer.StreamListener
Terminates the stream; do not call FlightProducer.StreamListener.onCompleted()
.
onError
in interface FlightProducer.StreamListener<PutResult>
public void onCompleted()
FlightProducer.StreamListener
onCompleted
in interface FlightProducer.StreamListener<PutResult>
public void close()
close
in interface AutoCloseable
public boolean isCancelled()
FlightClient.PutListener
By default, this always returns false. Implementations should provide an appropriate implementation, as otherwise, a DoPut operation may inadvertently block forever.
isCancelled
in interface FlightClient.PutListener
Copyright © 2023 The Apache Software Foundation. All rights reserved.