IMDG http://jira.mfd.msk:8088/browse/CLS-572 добавил настройку backup-count
This commit is contained in:
parent
269a74960b
commit
a3d2726b23
3 changed files with 32 additions and 5 deletions
|
|
@ -5,6 +5,7 @@ import com.hazelcast.core.MapLoader;
|
|||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
|
|
@ -12,6 +13,7 @@ import ru.spcex.clearing.imdg.base.AutoconfiguredMap;
|
|||
import ru.spcex.clearing.imdg.base.DictionaryTMapStore;
|
||||
import ru.spcex.clearing.imdg.businessevent.CompanyHistoryMapStore;
|
||||
import ru.spcex.clearing.imdg.businessobject.CompanyMapStore;
|
||||
import ru.spcex.clearing.imdg.config.element.ImdgSettings;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
|
@ -19,8 +21,12 @@ import java.util.HashSet;
|
|||
import java.util.List;
|
||||
|
||||
@Configuration
|
||||
public class PoolMapConfigs {
|
||||
public class PoolMapConfigs implements InitializingBean {
|
||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||
|
||||
@Autowired
|
||||
protected ImdgSettings settings;
|
||||
|
||||
@Autowired
|
||||
private CompanyMapStore companyMapStore;
|
||||
|
||||
|
|
@ -31,6 +37,15 @@ public class PoolMapConfigs {
|
|||
@Autowired
|
||||
private List<AutoconfiguredMap<?>> listOfAutopluginStores;
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
if (settings.getHazelcast().getBackupCount() != null) {
|
||||
log.debug("IMDG Setting backup-count = {}", settings.getHazelcast().getBackupCount());
|
||||
} else {
|
||||
log.info("IMDG Setting backup-count not set");
|
||||
}
|
||||
}
|
||||
|
||||
private MapStoreConfig makeDefaultMapStoreConfig(MapLoader<Long, ?> mapBean) {
|
||||
return new MapStoreConfig()
|
||||
.setImplementation(mapBean)
|
||||
|
|
@ -46,12 +61,14 @@ public class PoolMapConfigs {
|
|||
}
|
||||
|
||||
public MapConfig makeDefaultMapConfig(String mapName, MapLoader<Long, ?> mapBean) {
|
||||
return new MapConfig()
|
||||
MapConfig cfg = new MapConfig()
|
||||
.setName(mapName)
|
||||
.setInMemoryFormat(InMemoryFormat.OBJECT)
|
||||
.setMapStoreConfig(makeDefaultMapStoreConfig(mapBean))
|
||||
//fixme config: .setBackupCount(configRoot.getIMDG().getBackupCount())
|
||||
;
|
||||
.setMapStoreConfig(makeDefaultMapStoreConfig(mapBean));
|
||||
if (settings.getHazelcast().getBackupCount() != null) {
|
||||
cfg.setBackupCount(settings.getHazelcast().getBackupCount());
|
||||
}
|
||||
return cfg;
|
||||
}
|
||||
|
||||
private NearCacheConfig makeDefaultNearCacheConfig() {
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ public class HazelcastServerSettings {
|
|||
private String login;
|
||||
private String password;
|
||||
private List<String> clusterMembers;
|
||||
private Integer backupCount;
|
||||
|
||||
public int getListenPort() {
|
||||
return listenPort;
|
||||
|
|
@ -40,4 +41,12 @@ public class HazelcastServerSettings {
|
|||
public void setClusterMembers(List<String> clusterMembers) {
|
||||
this.clusterMembers = clusterMembers;
|
||||
}
|
||||
|
||||
public Integer getBackupCount() {
|
||||
return backupCount;
|
||||
}
|
||||
|
||||
public void setBackupCount(Integer backupCount) {
|
||||
this.backupCount = backupCount;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ imdg.hazelcast.listenPort=5701
|
|||
imdg.hazelcast.login=dev
|
||||
imdg.hazelcast.password=dev-pass
|
||||
imdg.hazelcast.cluster-members[0]=127.0.0.1
|
||||
imdg.hazelcast.backup-count=3
|
||||
imdg.database.login=clearing
|
||||
imdg.database.password=Aa111111
|
||||
imdg.database.url=jdbc:postgresql://10.200.200.133:5432/clearing?currentSchema=clearing_prod
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue