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.
Simplify cloning and overriding logic for FlightServer and FlightClient
Signed-off-by: Rishabh Maurya <[email protected]>
- Loading branch information
1 parent
9477085
commit aab8bc4
Showing
8 changed files
with
490 additions
and
343 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
459 changes: 237 additions & 222 deletions
459
plugins/arrow-flight-rpc/src/main/java/org/apache/arrow/flight/OSFlightClient.java
Large diffs are not rendered by default.
Oops, something went wrong.
58 changes: 58 additions & 0 deletions
58
plugins/arrow-flight-rpc/src/main/java/org/apache/arrow/flight/OSFlightClientBuilder.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,58 @@ | ||
/* | ||
* 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.apache.arrow.flight; | ||
|
||
import io.grpc.netty.NettyChannelBuilder; | ||
import io.netty.channel.EventLoopGroup; | ||
import io.netty.handler.ssl.SslContext; | ||
import org.apache.arrow.memory.BufferAllocator; | ||
|
||
import java.util.concurrent.ExecutorService; | ||
|
||
/** | ||
* Builder for FlightClient in OpenSearch. Overrides {@link OSFlightClient.Builder} to set SslContext, workerELG, | ||
* executorService and channelType | ||
*/ | ||
public class OSFlightClientBuilder extends OSFlightClient.Builder { | ||
private EventLoopGroup workerELG; | ||
private ExecutorService executorService; | ||
private Class<? extends io.netty.channel.Channel> channelType; | ||
private SslContext sslContext; | ||
|
||
public OSFlightClientBuilder(BufferAllocator allocator, | ||
Location location, | ||
Class<? extends io.netty.channel.Channel> channelType, | ||
ExecutorService executorService, | ||
EventLoopGroup workerELG, | ||
SslContext sslContext) { | ||
super(allocator, location); | ||
this.channelType = channelType; | ||
this.executorService = executorService; | ||
this.workerELG = workerELG; | ||
if (sslContext != null) { | ||
this.sslContext = sslContext; | ||
} | ||
} | ||
|
||
@Override | ||
public void configureBuilder(NettyChannelBuilder builder) { | ||
if (workerELG != null) { | ||
builder.eventLoopGroup(workerELG); | ||
} | ||
if (executorService != null) { | ||
builder.executor(executorService); | ||
} | ||
if (channelType != null) { | ||
builder.channelType(channelType); | ||
} | ||
if (sslContext != null) { | ||
builder.sslContext(sslContext); | ||
} | ||
} | ||
} |
Oops, something went wrong.