Skip to content

Commit

Permalink
Simplify cloning and overriding logic for FlightServer and FlightClient
Browse files Browse the repository at this point in the history
Signed-off-by: Rishabh Maurya <[email protected]>
  • Loading branch information
rishabhmaurya committed Feb 13, 2025
1 parent 9477085 commit de748f1
Show file tree
Hide file tree
Showing 7 changed files with 489 additions and 342 deletions.
9 changes: 9 additions & 0 deletions plugins/arrow-flight-rpc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ tasks.named('test').configure {
}
}

spotless {
java {
// Files to exclude from formatting
targetExclude 'src/main/java/org/apache/arrow/flight/**/*.java'
}
}


tasks.named("dependencyLicenses").configure {
mapping from: /netty-.*/, to: 'netty'
mapping from: /grpc-.*/, to: 'grpc'
Expand All @@ -95,6 +103,7 @@ tasks.named('forbiddenApisMain').configure {
]
}


tasks.named('thirdPartyAudit').configure {
ignoreMissingClasses(
'com.google.gson.stream.JsonReader',
Expand Down

Large diffs are not rendered by default.

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);
}
}
}
Loading

0 comments on commit de748f1

Please sign in to comment.