dao-jun commented on code in PR #22767:
URL: https://github.com/apache/pulsar/pull/22767#discussion_r1617849828
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/plugin/EntryFilterWithClassLoader.java:
##########
@@ -23,22 +23,27 @@
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;
import org.apache.bookkeeper.mledger.Entry;
+import org.apache.pulsar.broker.ClassLoaderSwitcher;
import org.apache.pulsar.common.nar.NarClassLoader;
@Slf4j
@ToString
public class EntryFilterWithClassLoader implements EntryFilter {
private final EntryFilter entryFilter;
private final NarClassLoader classLoader;
+ private final boolean classLoaderOwned;
- public EntryFilterWithClassLoader(EntryFilter entryFilter, NarClassLoader
classLoader) {
+ public EntryFilterWithClassLoader(EntryFilter entryFilter, NarClassLoader
classLoader, boolean classLoaderOwned) {
this.entryFilter = entryFilter;
this.classLoader = classLoader;
+ this.classLoaderOwned = classLoaderOwned;
}
@Override
public FilterResult filterEntry(Entry entry, FilterContext context) {
- return entryFilter.filterEntry(entry, context);
+ try (ClassLoaderSwitcher switcher = new
ClassLoaderSwitcher(classLoader)) {
Review Comment:
maybe follow https://github.com/apache/pulsar/pull/22790 's pattern is better
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]