com.hazelcast.config.Config.getProperty()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(155)

本文整理了Java中com.hazelcast.config.Config.getProperty()方法的一些代码示例,展示了Config.getProperty()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Config.getProperty()方法的具体详情如下:
包路径:com.hazelcast.config.Config
类名称:Config
方法名:getProperty

Config.getProperty介绍

[英]Returns the value for a named property. If it has not been previously set, it will try to get the value from the system properties.
[中]返回命名属性的值。如果之前未设置,它将尝试从系统属性中获取值。

代码示例

代码示例来源:origin: stackoverflow.com

Config config = Config.getInstance(getServletContext());
String property = config.getProperty("somekey");

代码示例来源:origin: hazelcast/hazelcast-jet

@Override
public String getProperty(String name) {
  return staticConfig.getProperty(name);
}

代码示例来源:origin: com.hazelcast/hazelcast-all

@Override
public String getProperty(String name) {
  return staticConfig.getProperty(name);
}

代码示例来源:origin: stackoverflow.com

Config config = Config.getInstance(getApplicationContext());
config.getProperty(...);

代码示例来源:origin: stackoverflow.com

enum SingleService {
  INSTANCE;

  private String conn;
  private String user;
  private String pass;
  private SingleService instance;

  public synchronized void init(Config config) throws SomeException {
    // don't leave in a half state if we fail.
    internalService = null; 

    conn = config.getProperty("conn");
    user = config.getProperty("user");
    pass = config.getProperty("pass");
    internalService = tryConnect(conn, user, pass);
  }

  public synchronized void methodForService() {
    if (internalService == null) throw new IllegalSateException();
    // do work.
  }
}

代码示例来源:origin: stackoverflow.com

public class MyServlet extends HttpServlet {

  protected Config config = new Config();

  @Override 
  public void doGet(request, response) throws ServletException{

    Strign s = config.getProperty("myParam");

  }

}

代码示例来源:origin: hazelcast/hazelcast-jet

private AddressDefinition getSystemConfiguredAddress() throws UnknownHostException {
  String address = config.getProperty("hazelcast.local.localAddress");
  if (address != null) {
    address = address.trim();
    if ("127.0.0.1".equals(address) || "localhost".equals(address)) {
      return pickLoopbackAddress(address);
    } else {
      logger.info("Picking address configured by property 'hazelcast.local.localAddress'");
      return new AddressDefinition(address, InetAddress.getByName(address));
    }
  }
  return null;
}

代码示例来源:origin: com.hazelcast/hazelcast-all

private AddressDefinition getSystemConfiguredAddress() throws UnknownHostException {
  String address = config.getProperty("hazelcast.local.localAddress");
  if (address != null) {
    address = address.trim();
    if ("127.0.0.1".equals(address) || "localhost".equals(address)) {
      return pickLoopbackAddress(address);
    } else {
      logger.info("Picking address configured by property 'hazelcast.local.localAddress'");
      return new AddressDefinition(address, InetAddress.getByName(address));
    }
  }
  return null;
}

代码示例来源:origin: com.hazelcast/hazelcast-hibernate52

public static long getMaxOperationTimeout(final HazelcastInstance instance) {
    String maxOpTimeoutProp = null;
    try {
      Config config = instance.getConfig();
      maxOpTimeoutProp = config.getProperty(CacheEnvironment.HAZELCAST_OPERATION_TIMEOUT);
    } catch (UnsupportedOperationException e) {
      // HazelcastInstance is instance of HazelcastClient.
      Logger.getLogger(HazelcastTimestamper.class).finest(e);
    }
    if (maxOpTimeoutProp != null) {
      return Long.parseLong(maxOpTimeoutProp);
    }
    return Long.MAX_VALUE;
  }
}

代码示例来源:origin: com.hazelcast/hazelcast-all

public static long getMaxOperationTimeout(final HazelcastInstance instance) {
    String maxOpTimeoutProp = null;
    try {
      Config config = instance.getConfig();
      maxOpTimeoutProp = config.getProperty(CacheEnvironment.HAZELCAST_OPERATION_TIMEOUT);
    } catch (UnsupportedOperationException e) {
      // HazelcastInstance is instance of HazelcastClient.
      Logger.getLogger(HazelcastTimestamper.class).finest(e);
    }
    if (maxOpTimeoutProp != null) {
      return Long.parseLong(maxOpTimeoutProp);
    }
    return Long.MAX_VALUE;
  }
}

代码示例来源:origin: com.hazelcast/hazelcast-hibernate4

public static long getMaxOperationTimeout(HazelcastInstance instance) {
    String maxOpTimeoutProp = null;
    try {
      Config config = instance.getConfig();
      maxOpTimeoutProp = config.getProperty(CacheEnvironment.HAZELCAST_OPERATION_TIMEOUT);
    } catch (UnsupportedOperationException e) {
      // HazelcastInstance is instance of HazelcastClient.
      Logger.getLogger(HazelcastTimestamper.class).finest(e);
    }
    if (maxOpTimeoutProp != null) {
      return Long.parseLong(maxOpTimeoutProp);
    }
    return Long.MAX_VALUE;
  }
}

代码示例来源:origin: com.hazelcast/hazelcast-hibernate5

public static long getMaxOperationTimeout(final HazelcastInstance instance) {
    String maxOpTimeoutProp = null;
    try {
      Config config = instance.getConfig();
      maxOpTimeoutProp = config.getProperty(CacheEnvironment.HAZELCAST_OPERATION_TIMEOUT);
    } catch (UnsupportedOperationException e) {
      // HazelcastInstance is instance of HazelcastClient.
      Logger.getLogger(HazelcastTimestamper.class).finest(e);
    }
    if (maxOpTimeoutProp != null) {
      return Long.parseLong(maxOpTimeoutProp);
    }
    return Long.MAX_VALUE;
  }
}

代码示例来源:origin: hazelcast/hazelcast-jet

private AddressDefinition getPublicAddress(int port) throws UnknownHostException {
  String address = config.getProperty("hazelcast.local.publicAddress");
  if (address == null) {
    address = config.getNetworkConfig().getPublicAddress();
  }
  if (address != null) {
    address = address.trim();
    if ("127.0.0.1".equals(address) || "localhost".equals(address)) {
      return pickLoopbackAddress(address, port);
    } else {
      // allow port to be defined in same string in the form of <host>:<port>, e.g. 10.0.0.0:1234
      AddressUtil.AddressHolder holder = AddressUtil.getAddressHolder(address, port);
      return new AddressDefinition(holder.getAddress(), holder.getPort(), InetAddress.getByName(holder.getAddress()));
    }
  }
  return null;
}

代码示例来源:origin: com.hazelcast/hazelcast-all

private AddressDefinition getPublicAddress(int port) throws UnknownHostException {
  String address = config.getProperty("hazelcast.local.publicAddress");
  if (address == null) {
    address = config.getNetworkConfig().getPublicAddress();
  }
  if (address != null) {
    address = address.trim();
    if ("127.0.0.1".equals(address) || "localhost".equals(address)) {
      return pickLoopbackAddress(address, port);
    } else {
      // allow port to be defined in same string in the form of <host>:<port>, e.g. 10.0.0.0:1234
      AddressUtil.AddressHolder holder = AddressUtil.getAddressHolder(address, port);
      return new AddressDefinition(holder.getAddress(), holder.getPort(), InetAddress.getByName(holder.getAddress()));
    }
  }
  return null;
}

代码示例来源:origin: hazelcast/hazelcast-jet

public ConfigCheck(Config config, String joinerType) {
  this.joinerType = joinerType;
  // Copying all properties relevant for checking
  properties.put(PARTITION_COUNT.getName(), config.getProperty(PARTITION_COUNT.getName()));
  properties.put(APPLICATION_VALIDATION_TOKEN.getName(), config.getProperty(APPLICATION_VALIDATION_TOKEN.getName()));
  // Copying group-config settings
  GroupConfig groupConfig = config.getGroupConfig();
  if (groupConfig != null) {
    this.groupName = groupConfig.getName();
  }
  // Partition-group settings
  final PartitionGroupConfig partitionGroupConfig = config.getPartitionGroupConfig();
  if (partitionGroupConfig != null) {
    partitionGroupEnabled = partitionGroupConfig.isEnabled();
    if (partitionGroupEnabled) {
      memberGroupType = partitionGroupConfig.getGroupType();
    } else {
      memberGroupType = PartitionGroupConfig.MemberGroupType.PER_MEMBER;
    }
  }
}

代码示例来源:origin: com.hazelcast/hazelcast-all

public ConfigCheck(Config config, String joinerType) {
  this.joinerType = joinerType;
  // Copying all properties relevant for checking
  properties.put(PARTITION_COUNT.getName(), config.getProperty(PARTITION_COUNT.getName()));
  properties.put(APPLICATION_VALIDATION_TOKEN.getName(), config.getProperty(APPLICATION_VALIDATION_TOKEN.getName()));
  // Copying group-config settings
  GroupConfig groupConfig = config.getGroupConfig();
  if (groupConfig != null) {
    this.groupName = groupConfig.getName();
  }
  // Partition-group settings
  final PartitionGroupConfig partitionGroupConfig = config.getPartitionGroupConfig();
  if (partitionGroupConfig != null) {
    partitionGroupEnabled = partitionGroupConfig.isEnabled();
    if (partitionGroupEnabled) {
      memberGroupType = partitionGroupConfig.getGroupType();
    } else {
      memberGroupType = PartitionGroupConfig.MemberGroupType.PER_MEMBER;
    }
  }
}

相关文章

微信公众号

最新文章

更多

Config类方法