Skip to content

Commit

Permalink
[fix][client] Fix LoadManagerReport not found
Browse files Browse the repository at this point in the history
Signed-off-by: Zixuan Liu <[email protected]>
  • Loading branch information
nodece committed Jan 23, 2025
1 parent 52e8730 commit a2aef7b
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 22 deletions.
4 changes: 0 additions & 4 deletions pulsar-client-admin-shaded/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -364,10 +364,6 @@
<pattern>org.apache.pulsar.checksum</pattern>
<shadedPattern>org.apache.pulsar.shade.org.apache.pulsar.checksum</shadedPattern>
</relocation>
<relocation>
<pattern>org.apache.pulsar.policies</pattern>
<shadedPattern>org.apache.pulsar.shade.org.apache.pulsar.policies</shadedPattern>
</relocation>
<relocation>
<pattern>org.asynchttpclient</pattern>
<shadedPattern>org.apache.pulsar.shade.org.asynchttpclient</shadedPattern>
Expand Down
4 changes: 0 additions & 4 deletions pulsar-client-all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -424,10 +424,6 @@
<pattern>org.apache.commons</pattern>
<shadedPattern>org.apache.pulsar.shade.org.apache.commons</shadedPattern>
</relocation>
<relocation>
<pattern>org.apache.pulsar.policies</pattern>
<shadedPattern>org.apache.pulsar.shade.org.apache.pulsar.policies</shadedPattern>
</relocation>
<relocation>
<pattern>org.asynchttpclient</pattern>
<shadedPattern>org.apache.pulsar.shade.org.asynchttpclient</shadedPattern>
Expand Down
4 changes: 0 additions & 4 deletions pulsar-client-shaded/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -336,10 +336,6 @@
<pattern>org.apache.commons</pattern>
<shadedPattern>org.apache.pulsar.shade.org.apache.commons</shadedPattern>
</relocation>
<relocation>
<pattern>org.apache.pulsar.policies</pattern>
<shadedPattern>org.apache.pulsar.shade.org.apache.pulsar.policies</shadedPattern>
</relocation>
<relocation>
<pattern>org.asynchttpclient</pattern>
<shadedPattern>org.apache.pulsar.shade.org.asynchttpclient</shadedPattern>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import com.fasterxml.jackson.module.paramnames.ParameterNamesModule;
import java.util.concurrent.atomic.AtomicReference;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ClassUtils;
import org.apache.pulsar.client.admin.internal.data.AuthPoliciesImpl;
import org.apache.pulsar.common.functions.FunctionConfig;
import org.apache.pulsar.common.functions.FunctionState;
Expand Down Expand Up @@ -263,15 +262,7 @@ private static void setAnnotationsModule(ObjectMapper mapper) {
mapper.addMixIn(FunctionState.class, JsonIgnorePropertiesMixIn.class);
mapper.addMixIn(Metrics.class, MetricsMixIn.class);

try {
// We look for LoadManagerReport first, then add deserializer to the module
// With shaded client, org.apache.pulsar.policies is relocated to
// org.apache.pulsar.shade.org.apache.pulsar.policies
ClassUtils.getClass("org.apache.pulsar.policies.data.loadbalancer.LoadManagerReport");
module.addDeserializer(LoadManagerReport.class, new LoadReportDeserializer());
} catch (ClassNotFoundException e) {
log.debug("Add LoadManagerReport deserializer failed because LoadManagerReport.class has been shaded", e);
}
module.addDeserializer(LoadManagerReport.class, new LoadReportDeserializer());

module.setAbstractTypes(resolver);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public void checkAdmin() throws PulsarClientException, PulsarAdminException {
expectedNamespacesList.add("public/default");
expectedNamespacesList.add("public/functions");
Assert.assertEquals(admin.namespaces().getNamespaces("public"), expectedNamespacesList);
Assert.assertNotNull(admin.brokerStats().getLoadReport());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public void checkAdmin() throws PulsarClientException, PulsarAdminException {
expectedNamespacesList.add("public/default");
expectedNamespacesList.add("public/functions");
Assert.assertEquals(admin.namespaces().getNamespaces("public"), expectedNamespacesList);
Assert.assertNotNull(admin.brokerStats().getLoadReport());
}

@Override
Expand Down

0 comments on commit a2aef7b

Please sign in to comment.