This commit is contained in:
parent
60d9801a5f
commit
96955aa0aa
2 changed files with 16 additions and 13 deletions
|
|
@ -8,7 +8,6 @@ import org.springframework.context.annotation.Bean;
|
|||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import ru.spcex.clearing.historyimdg.config.element.ImdgSettings;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService;
|
||||
|
||||
@Configuration
|
||||
|
|
@ -26,7 +25,7 @@ public class HistoryHazelcastClientConfig {
|
|||
|
||||
@Autowired
|
||||
@Bean
|
||||
public ImdgProvider imdgProvider(
|
||||
public HazelcastService imdgProvider(
|
||||
@Qualifier("taskExecutorHazelcastClientInitializer") ThreadPoolTaskExecutor taskExecutorHazelcastClientInitializer,
|
||||
@Qualifier("taskExecutorIdGeneratorAwaiter") ThreadPoolTaskExecutor taskExecutorIdGeneratorAwaiter,
|
||||
ImdgSettings imdgSettings
|
||||
|
|
@ -35,7 +34,7 @@ public class HistoryHazelcastClientConfig {
|
|||
log.warn("Property \"backend-api.hazelcast.cluster-members\" not set!");
|
||||
throw new IllegalArgumentException("Property \"backend-api.hazelcast.cluster-members\" not set");
|
||||
}
|
||||
ImdgProvider imdg = new HazelcastService(taskExecutorHazelcastClientInitializer,
|
||||
HazelcastService imdg = new HazelcastService(taskExecutorHazelcastClientInitializer,
|
||||
taskExecutorIdGeneratorAwaiter,
|
||||
imdgSettings.getHazelcastClient());
|
||||
return imdg;
|
||||
|
|
|
|||
|
|
@ -14,25 +14,29 @@ import org.springframework.beans.factory.DisposableBean;
|
|||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import ru.clearing.classes.statics.data.misc.SessionHistory;
|
||||
import ru.spcex.clearing.historyimdg.component.SearchProxyBuilder;
|
||||
import ru.spcex.clearing.historyimdg.component.TodayQueueListener;
|
||||
import ru.spcex.clearing.historyimdg.index.SearchProxy;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.platform.classes.base.interfaces.WithId;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService;
|
||||
import ru.spcex.platform.imdg.iml.hazelcast.service.IHazelcastClusterStatus;
|
||||
|
||||
@Service
|
||||
public class TodayHistoryService implements InitializingBean, DisposableBean, IHazelcastClusterStatus {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
private final ImdgProvider imdgProvider;
|
||||
private final HazelcastService imdgProvider;
|
||||
private final HazelcastLifecycleSupport hzLifecycleSupport;
|
||||
private final SearchProxyBuilder searchProxyBuilder;
|
||||
private HazelcastInstance availableStorageHzInstance;
|
||||
//---- listeners ----
|
||||
|
||||
private TodayQueueListener<SessionHistory> sessionHistoryListener;
|
||||
|
||||
@Autowired
|
||||
public TodayHistoryService(ImdgProvider imdgProvider, HazelcastLifecycleSupport hzLifecycleSupport, SearchProxyBuilder searchProxyBuilder) {
|
||||
public TodayHistoryService(HazelcastService imdgProvider,
|
||||
HazelcastLifecycleSupport hzLifecycleSupport,
|
||||
SearchProxyBuilder searchProxyBuilder) {
|
||||
this.imdgProvider = imdgProvider;
|
||||
this.hzLifecycleSupport = hzLifecycleSupport;
|
||||
this.searchProxyBuilder = searchProxyBuilder;
|
||||
|
|
@ -40,7 +44,7 @@ public class TodayHistoryService implements InitializingBean, DisposableBean, IH
|
|||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
// imdgProvider.statusSubscribe(this);
|
||||
imdgProvider.statusSubscribe(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -79,8 +83,8 @@ public class TodayHistoryService implements InitializingBean, DisposableBean, IH
|
|||
|
||||
Long maxSearchId = targetMap.aggregate(Aggregators.longMax("id"));
|
||||
if (maxSearchId == null) maxSearchId = 0L;
|
||||
Collection<Long> ids = historyMap.project(Projections.singleAttribute("id")
|
||||
, Predicates.greaterThan("id", maxSearchId));
|
||||
Collection<Long> ids = historyMap.project(Projections.singleAttribute("id"),
|
||||
Predicates.greaterThan("id", maxSearchId));
|
||||
for (Long id : ids) {
|
||||
T t = historyMap.get(id);
|
||||
targetMap.set(id, searchProxyBuilder.build(t, clazz));
|
||||
|
|
@ -104,9 +108,9 @@ public class TodayHistoryService implements InitializingBean, DisposableBean, IH
|
|||
public void getAvailable(HazelcastInstance storageHzInstanceInited) {
|
||||
this.availableStorageHzInstance = storageHzInstanceInited;
|
||||
//-----
|
||||
// repoMMOrderListener = registerListener(Map_RepoMMOrder, Map_RepoMMOrderSearch, RepoMMOrder.class);
|
||||
// loadSnapshot(Map_RepoMMOrder, Map_RepoMMOrderSearch, RepoMMOrder.class);
|
||||
// repoMMOrderListener.startProcessingNewEntries();
|
||||
sessionHistoryListener = registerListener(IMDGDistributedNames.Map_SessionHistory, IMDGDistributedNames.Map_SearchSessionHistory, SessionHistory.class);
|
||||
loadSnapshot(IMDGDistributedNames.Map_SessionHistory, IMDGDistributedNames.Map_SearchSessionHistory, SessionHistory.class);
|
||||
sessionHistoryListener.startProcessingNewEntries();
|
||||
//-----
|
||||
|
||||
this.availableStorageHzInstance = null;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue