本文整理汇总了Java中com.hazelcast.core.Member.getStringAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java Member.getStringAttribute方法的具体用法?Java Member.getStringAttribute怎么用?Java Member.getStringAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.hazelcast.core.Member
的用法示例。
在下文中一共展示了Member.getStringAttribute方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import com.hazelcast.core.Member; //导入方法依赖的package包/类
public static void main(String[] args) {
String contextPath = System.getProperty(pn_config_context_file);
logger.info("Starting BagriDB node with Context [{}]", contextPath);
context = new ClassPathXmlApplicationContext(contextPath);
HazelcastInstance hz = context.getBean(hz_instance, HazelcastInstance.class);
hz.getUserContext().put(schema_context, context);
Member local = hz.getCluster().getLocalMember();
String name = local.getStringAttribute(pn_cluster_node_name);
String role = local.getStringAttribute(pn_cluster_node_role);
logger.debug("System Cache started with Config: {}; Instance: {}", hz.getConfig(), hz.getClass().getName());
logger.debug("Cluster size: {}; Node: {}; Role: {}", hz.getCluster().getMembers().size(), name, role);
if (isAdminRole(role)) {
initAdminNode(hz);
// discover active schema server nodes now..
lookupManagedNodes(hz);
} else {
initServerNode(hz, local);
}
}
示例2: memberAttributeChanged
import com.hazelcast.core.Member; //导入方法依赖的package包/类
@Override
public void memberAttributeChanged(MemberAttributeEvent memberAttributeEvent) {
logger.trace("memberAttributeChanged.enter; event: {}; attribute: {}; value: {}",
memberAttributeEvent, memberAttributeEvent.getKey(), memberAttributeEvent.getValue());
// if attribute is schemas then deploy schema on member ?
if (pn_cluster_node_schemas.equals(memberAttributeEvent.getKey())) {
Member member = memberAttributeEvent.getMember();
String nodeName = member.getStringAttribute(pn_cluster_node_name);
if (memberAttributeEvent.getOperationType() == MemberAttributeOperationType.PUT) {
// set
String newSchemas = (String) memberAttributeEvent.getValue();
// do this via memberAdded??
} else {
// remove all
}
}
}
示例3: compare
import com.hazelcast.core.Member; //导入方法依赖的package包/类
@Override
public int compare(Member m1, Member m2) {
String role1 = m1.getStringAttribute(pn_cluster_node_role);
String role2 = m2.getStringAttribute(pn_cluster_node_role);
if (role1.equals(role2)) {
return m1.getUuid().compareTo(m2.getUuid());
}
return "admin".equals(role1) ? +1 : -1;
}
示例4: getMemberSchemas
import com.hazelcast.core.Member; //导入方法依赖的package包/类
public static String[] getMemberSchemas(Member member) {
String schemas = member.getStringAttribute(pn_cluster_node_schemas);
if (schemas != null && schemas.trim().length() > 0) {
return schemas.split(" ");
}
return new String[0];
}
示例5: call
import com.hazelcast.core.Member; //导入方法依赖的package包/类
@Override
public Boolean call() throws Exception {
logger.trace("call.enter;");
HazelcastInstance hzInstance = findSystemInstance();
Member member = hzInstance.getCluster().getLocalMember();
boolean result = false;
for (String key: options.stringPropertyNames()) {
String oldValue = member.getStringAttribute(key);
String newValue = options.getProperty(key);
if (!(newValue.equals(oldValue))) {
member.setStringAttribute(key, newValue);
result = true;
}
}
// now flush node properties no its props file
String propsPath = System.getProperty(pn_config_path);
String propsName = System.getProperty(pn_config_properties_file);
if (propsName != null) {
storeOptions(propsPath + "/" + propsName);
} else {
logger.warn("call; properties file name not specified; can't persist them");
}
logger.trace("call.exit; returning: {}", result);
return result;
}
示例6: ClusterMemberImpl
import com.hazelcast.core.Member; //导入方法依赖的package包/类
ClusterMemberImpl(Member member) {
this.uuid = member.getUuid() ;
this.hostname = member.getSocketAddress().getHostName() ;
this.ipAddress = member.getSocketAddress().getAddress().getHostAddress() ;
this.port = member.getSocketAddress().getPort() ;
this.memberName = member.getStringAttribute("member-name") ;
}
示例7: initServerNode
import com.hazelcast.core.Member; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private static void initServerNode(HazelcastInstance systemInstance, Member local) {
//check that new node has unique instance num..
String instanceNum = local.getStringAttribute(pn_node_instance);
if (instanceNum == null) {
instanceNum = "0";
}
Set<Member> members = systemInstance.getCluster().getMembers();
for (Member member: members) {
if (!local.getUuid().equals(member.getUuid()) && !isAdminRole(member.getStringAttribute(pn_cluster_node_role))) {
if (instanceNum.equals(member.getStringAttribute(pn_node_instance))) {
logger.error("initServerNode; The node with instance no '{}' already exists: {}; stopping application.", instanceNum, member.getUuid());
System.exit(1);
}
}
}
Collection<Module> cModules = null;
Collection<Library> cLibraries = null;
Collection<DataFormat> cFormats = null;
Map<String, Schema> schemaCache = null;
SystemConfig cfg = context.getBean(SystemConfig.class);
Set<Member> admins = getAdmins(systemInstance);
if (admins.size() == 0) {
if (cfg.isLoaded()) {
Collection<Schema> cSchemas = (Collection<Schema>) cfg.getEntities(Schema.class);
schemaCache = new HashMap<String, Schema>(cSchemas.size());
for (Schema schema: cSchemas) {
schemaCache.put(schema.getName(), schema);
}
cModules = (Collection<Module>) cfg.getEntities(Module.class);
cLibraries = (Collection<Library>) cfg.getEntities(Library.class);
cFormats = (Collection<DataFormat>) cfg.getEntities(DataFormat.class);
}
}
String[] aSchemas = getMemberSchemas(local);
for (String name: aSchemas) {
String schemaName = name.trim();
logger.debug("initServerNode; going to deploy schema: {}", schemaName);
boolean initialized = false;
if (schemaCache != null) {
Schema xSchema = schemaCache.get(schemaName);
if (xSchema != null) {
initialized = initSchema(systemInstance, local, xSchema);
//String store = xSchema.getProperty(pn_schema_store_enabled);
ApplicationContext schemaContext = getContext(schemaName);
if (initialized) {
// set modules and libraries
SchemaRepositoryImpl xRepo = schemaContext.getBean(bean_id, SchemaRepositoryImpl.class);
xRepo.setLibraries(cLibraries);
for (Module module: cModules) {
try {
ModuleCacheStore.loadModule(module);
} catch (IOException e) {
logger.warn("initServerNode; cannot load Module {} for schema '{}'!", module, schemaName);
}
}
xRepo.setModules(cModules);
xRepo.setDataFormats(cFormats);
xRepo.afterInit();
//xRepo.getHzInstance().getCluster().changeClusterState(ClusterState.ACTIVE);
logger.info("initServerNode; schema {} initialization complete", schemaName);
}
}
}
// notify admin node about new schema Member
if (admins.size() > 0) {
notifyAdmins(systemInstance, local, schemaName, initialized);
}
}
}