[
https://issues.apache.org/jira/browse/DRILL-4841?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15553347#comment-15553347
]
ASF GitHub Bot commented on DRILL-4841:
---------------------------------------
Github user paul-rogers commented on a diff in the pull request:
https://github.com/apache/drill/pull/565#discussion_r82267107
--- Diff:
exec/java-exec/src/main/java/org/apache/drill/exec/client/DrillClient.java ---
@@ -688,4 +802,142 @@ public DrillBuf getBuffer() {
return null;
}
}
+
+ /**
+ * Return a new {@link DrillClient.Builder Drill client builder}.
+ * @return a new builder
+ */
+ public static Builder newBuilder() {
+ return new Builder();
+ }
+
+ /**
+ * Helper class to construct a {@link DrillClient Drill client}.
+ */
+ public static class Builder {
+
+ private DrillConfig config;
+ private BufferAllocator allocator;
+ private ClusterCoordinator clusterCoordinator;
+ private EventLoopGroup eventLoopGroup;
+ private ExecutorService executor;
+
+ // defaults
+ private boolean supportComplexTypes = true;
+ private boolean isDirectConnection = false;
+
+ /**
+ * Sets the {@link DrillConfig configuration} for this client.
+ *
+ * @param drillConfig drill configuration
+ * @return this builder
+ */
+ public Builder setConfig(DrillConfig drillConfig) {
+ this.config = drillConfig;
+ return this;
+ }
+
+ /**
+ * Sets the {@link DrillConfig configuration} for this client based on
the given file.
+ *
+ * @param fileName configuration file name
+ * @return this builder
+ */
+ public Builder setConfigFromFile(final String fileName) {
+ this.config = DrillConfig.create(fileName);
+ return this;
+ }
+
+ /**
+ * Sets the {@link BufferAllocator buffer allocator} to be used by
this client.
+ * If this is not set, an allocator will be created based on the
configuration.
+ *
+ * If this is set, the caller is responsible for closing the given
allocator.
+ *
+ * @param allocator buffer allocator
+ * @return this builder
+ */
+ public Builder setAllocator(final BufferAllocator allocator) {
+ this.allocator = allocator;
+ return this;
+ }
+
+ /**
+ * Sets the {@link ClusterCoordinator cluster coordinator} that this
client
--- End diff --
When would I use this rather than letting Drill create it from the config?
Would I do this if I have multiple Drill clients in a single app? Or, will the
underlying code know to share the same coordinator?
> Use user server event loop group for web clients
> ------------------------------------------------
>
> Key: DRILL-4841
> URL: https://issues.apache.org/jira/browse/DRILL-4841
> Project: Apache Drill
> Issue Type: Improvement
> Components: Client - HTTP
> Reporter: Sudheesh Katkam
> Assignee: Sorabh Hamirwasia
> Priority: Minor
>
> Currently we spawn an event loop group for handling requests from clients.
> This group should also be used to handles responses (from server) for web
> clients.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)