klion26 commented on a change in pull request #8967: [FLINK-13059][Cassandra
Connector] Release Semaphore correctly on Exception in send()
URL: https://github.com/apache/flink/pull/8967#discussion_r303753571
##########
File path:
flink-connectors/flink-connector-cassandra/src/main/java/org/apache/flink/streaming/connectors/cassandra/CassandraSinkBase.java
##########
@@ -158,8 +164,17 @@ private void checkAsyncErrors() throws Exception {
}
}
- private void flush() {
-
semaphore.acquireUninterruptibly(config.getMaxConcurrentRequests());
+ private void flush() throws InterruptedException, TimeoutException {
+ if (!semaphore.tryAcquire(config.getMaxConcurrentRequests(),
config.getMaxConcurrentRequestsTimeout().toMillis(), TimeUnit.MILLISECONDS)) {
Review comment:
Do you think we should refactor the `tryAcquire()` function to
`tryAcquire(int permits)` so that we can reuse it here?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services