Skip to content

Commit

Permalink
LPS-199494 Replace ServiceProxyFactory with Snapshot in class HitsPro…
Browse files Browse the repository at this point in the history
…cessorRegistryUtil
  • Loading branch information
Jiaxu Wei authored and brianchandotcom committed Oct 23, 2023
1 parent 0ae7d67 commit 635e1b8
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

package com.liferay.portal.kernel.search.hits;

import com.liferay.portal.kernel.module.service.Snapshot;
import com.liferay.portal.kernel.search.Hits;
import com.liferay.portal.kernel.search.SearchContext;
import com.liferay.portal.kernel.search.SearchException;
import com.liferay.portal.kernel.util.ServiceProxyFactory;

/**
* @author Michael C. Han
Expand All @@ -18,12 +18,14 @@ public class HitsProcessorRegistryUtil {
public static boolean process(SearchContext searchContext, Hits hits)
throws SearchException {

return _hitsProcessorRegistry.process(searchContext, hits);
HitsProcessorRegistry hitsProcessorRegistry =
_hitsProcessorRegistrySnapshot.get();

return hitsProcessorRegistry.process(searchContext, hits);
}

private static volatile HitsProcessorRegistry _hitsProcessorRegistry =
ServiceProxyFactory.newServiceTrackedInstance(
HitsProcessorRegistry.class, HitsProcessorRegistryUtil.class,
"_hitsProcessorRegistry", false);
private static final Snapshot<HitsProcessorRegistry>
_hitsProcessorRegistrySnapshot = new Snapshot<>(
HitsProcessorRegistryUtil.class, HitsProcessorRegistry.class);

}

0 comments on commit 635e1b8

Please sign in to comment.