forked from opensearch-project/OpenSearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1cfc0b3
commit e7c70f4
Showing
14 changed files
with
798 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
modules/arrow-flight/src/main/java/org/opensearch/flight/BaseBackpressureStrategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.flight; | ||
|
||
import org.apache.arrow.flight.BackpressureStrategy; | ||
|
||
public class BaseBackpressureStrategy extends BackpressureStrategy.CallbackBackpressureStrategy { | ||
private final Runnable readyCallback; | ||
private final Runnable cancelCallback; | ||
|
||
BaseBackpressureStrategy(Runnable readyCallback, Runnable cancelCallback) { | ||
this.readyCallback = readyCallback; | ||
this.cancelCallback = cancelCallback; | ||
} | ||
|
||
/** Callback to execute when the listener is ready. */ | ||
protected void readyCallback() { | ||
if (readyCallback != null) { | ||
readyCallback.run(); | ||
} | ||
} | ||
|
||
/** Callback to execute when the listener is cancelled. */ | ||
protected void cancelCallback() { | ||
if (cancelCallback != null) { | ||
cancelCallback.run(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.