Skip to content

Commit d84d9a4

Browse files
merlimatnikhil-ctds
authored andcommitted
[fix] Initialize UrlServiceProvider before trying to use transaction coordinator (apache#23914)
(cherry picked from commit 0e3b46e)
1 parent fb11692 commit d84d9a4

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientBuilderImpl.java

+1-5
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,7 @@ public PulsarClient build() throws PulsarClientException {
6464
if (conf.getAuthentication() == null || conf.getAuthentication() == AuthenticationDisabled.INSTANCE) {
6565
setAuthenticationFromPropsIfAvailable(conf);
6666
}
67-
PulsarClient client = new PulsarClientImpl(conf);
68-
if (conf.getServiceUrlProvider() != null) {
69-
conf.getServiceUrlProvider().initialize(client);
70-
}
71-
return client;
67+
return new PulsarClientImpl(conf);
7268
}
7369

7470
@Override

pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarClientImpl.java

+4
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,10 @@ private PulsarClientImpl(ClientConfigurationData conf, EventLoopGroup eventLoopG
238238
this.timer = timer;
239239
}
240240

241+
if (conf.getServiceUrlProvider() != null) {
242+
conf.getServiceUrlProvider().initialize(this);
243+
}
244+
241245
if (conf.isEnableTransaction()) {
242246
tcClient = new TransactionCoordinatorClientImpl(this);
243247
try {

0 commit comments

Comments
 (0)