コード例 #1
0
 /**
  * @param propertyName the name of the property key
  * @param defaultValue the default value to return if no configured property is found or {@link
  *     ConfigProperty#NULL} if no default value should be returned.
  * @return the configured value or the defaultValue according to the NULL logic.
  */
 protected String getPropertyValue(String propertyName, String defaultValue) {
   String configuredValue;
   if (ConfigProperty.NULL.equals(defaultValue)) {
     // no special defaultValue has been configured
     configuredValue = ConfigResolver.getPropertyValue(propertyName);
   } else {
     configuredValue = ConfigResolver.getPropertyValue(propertyName, defaultValue);
   }
   return configuredValue;
 }
コード例 #2
0
 private void ensureInstance() throws IOException {
   if (instance == null) { // can already be initialized when called from ContextualStorage
     instance =
         Hazelcast.getHazelcastInstanceByName(
             ConfigResolver.getPropertyValue(
                 ClusterScopeExtension.class.getName() + ".hazelcast-instance",
                 "cluster-scope-instance"));
     if (instance == null) {
       final String hazelcastXml =
           ConfigResolver.getPropertyValue(
               ClusterScopeExtension.class.getName() + ".hazelcast-xml");
       instance =
           hazelcastXml == null
               ? Hazelcast.newHazelcastInstance()
               : Hazelcast.newHazelcastInstance(new UrlXmlConfig(hazelcastXml));
     }
   }
 }
コード例 #3
0
 void addClusterScope(final @Observes AfterBeanDiscovery afb, final BeanManager bm) {
   mapName =
       ConfigResolver.getPropertyValue(
           ClusterScopeExtension.class.getName() + ".hazelcast-ref", "cluster-scope-map");
   afb.addContext(new ClusterContext());
 }