Skip to content

Commit f7b8c28

Browse files
committed
Use proto 0.8.0 and remove extra loadExternalConverters()
Signed-off-by: Karen Xu <[email protected]>
1 parent 7aeb8db commit f7b8c28

File tree

5 files changed

+13
-39
lines changed

5 files changed

+13
-39
lines changed

modules/transport-grpc/spi/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ base {
1616

1717
dependencies {
1818
api project(":server")
19-
api "org.opensearch:protobufs:0.6.0"
19+
api "org.opensearch:protobufs:0.8.0"
2020
}
2121

2222
// no tests...yet?

modules/transport-grpc/spi/licenses/protobufs-0.6.0.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
6759aa64855c3d6d61a9cd52ad8afd73f01d8a11

modules/transport-grpc/spi/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/QueryBuilderProtoConverterSpiRegistry.java

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515
import org.opensearch.protobufs.QueryContainer;
1616

1717
import java.util.HashMap;
18-
import java.util.Iterator;
1918
import java.util.Map;
20-
import java.util.ServiceLoader;
2119

2220
/**
2321
* Registry for QueryBuilderProtoConverter implementations.
@@ -30,37 +28,13 @@ public class QueryBuilderProtoConverterSpiRegistry {
3028
private final Map<QueryContainer.QueryContainerCase, QueryBuilderProtoConverter> converterMap = new HashMap<>();
3129

3230
/**
33-
* Creates a new registry and loads all available converters.
31+
* Creates a new registry. External converters will be registered
32+
* via the OpenSearch ExtensiblePlugin mechanism.
3433
*/
3534
@Inject
3635
public QueryBuilderProtoConverterSpiRegistry() {
37-
// Discover converters from plugins using Java's ServiceLoader
38-
loadExternalConverters();
39-
}
40-
41-
/**
42-
* Loads external converters using Java's ServiceLoader mechanism.
43-
* Protected for testing purposes.
44-
*/
45-
protected void loadExternalConverters() {
46-
ServiceLoader<QueryBuilderProtoConverter> serviceLoader = ServiceLoader.load(QueryBuilderProtoConverter.class);
47-
Iterator<QueryBuilderProtoConverter> iterator = serviceLoader.iterator();
48-
49-
int count = 0;
50-
int failedCount = 0;
51-
while (iterator.hasNext()) {
52-
try {
53-
QueryBuilderProtoConverter converter = iterator.next();
54-
registerConverter(converter);
55-
count++;
56-
logger.info("Loaded external query converter for {}: {}", converter.getHandledQueryCase(), converter.getClass().getName());
57-
} catch (Exception e) {
58-
failedCount++;
59-
logger.error("Failed to load external query converter", e);
60-
}
61-
}
62-
63-
logger.info("Loaded {} external query converters ({} failed)", count, failedCount);
36+
// External converters are loaded via OpenSearch's ExtensiblePlugin mechanism
37+
// and registered manually via registerConverter() calls
6438
}
6539

6640
/**

plugins/arrow-flight-rpc/src/main/java/org/apache/arrow/flight/OSFlightClient.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public final static class Builder {
4747
private ExecutorService executorService;
4848
private Class<? extends io.netty.channel.Channel> channelType;
4949
private SslContext sslContext;
50-
50+
5151
private Builder() {}
5252

5353
Builder(BufferAllocator allocator, Location location) {
@@ -131,7 +131,7 @@ public FlightClient build() {
131131
builder.channelType(
132132
Class.forName("io.netty.channel.epoll.EpollDomainSocketChannel")
133133
.asSubclass(ServerChannel.class));
134-
final EventLoopGroup elg =
134+
final EventLoopGroup elg =
135135
Class.forName("io.netty.channel.epoll.EpollEventLoopGroup")
136136
.asSubclass(EventLoopGroup.class)
137137
.getDeclaredConstructor()
@@ -142,7 +142,7 @@ public FlightClient build() {
142142
builder.channelType(
143143
Class.forName("io.netty.channel.kqueue.KQueueDomainSocketChannel")
144144
.asSubclass(ServerChannel.class));
145-
final EventLoopGroup elg =
145+
final EventLoopGroup elg =
146146
Class.forName("io.netty.channel.kqueue.KQueueEventLoopGroup")
147147
.asSubclass(EventLoopGroup.class)
148148
.getDeclaredConstructor()
@@ -179,7 +179,7 @@ public FlightClient build() {
179179
builder.sslContext(sslContext);
180180
} else {
181181
final SslContextBuilder sslContextBuilder = GrpcSslContexts.forClient();
182-
182+
183183
if (!this.verifyServer) {
184184
sslContextBuilder.trustManager(InsecureTrustManagerFactory.INSTANCE);
185185
} else if (this.trustedCertificates != null
@@ -215,11 +215,11 @@ public FlightClient build() {
215215
if (channelType != null) {
216216
builder.channelType(channelType);
217217
}
218-
218+
219219
if (workerELG != null) {
220220
builder.eventLoopGroup(workerELG);
221221
}
222-
222+
223223
return new FlightClient(allocator, builder.build(), middleware);
224224
}
225225

@@ -232,7 +232,7 @@ public Builder channelType(Class<? extends io.netty.channel.Channel> channelType
232232
this.channelType = channelType;
233233
return this;
234234
}
235-
235+
236236
public Builder eventLoopGroup(EventLoopGroup workerELG) {
237237
this.workerELG = workerELG;
238238
return this;

0 commit comments

Comments
 (0)