private Long getLongValueFromEnvironment(String key) throws NamingException { Object val = getEnvironment().get(key); if (val != null && val instanceof String) { return Long.valueOf(Long.parseLong((String) val)); } return null; }
private String getLegacyClusterAffinity() throws NamingException { Object val = getEnvironment().get(JBossEJBProperties.PROPERTY_KEY_CLUSTERS); if (val != null && val instanceof String) { String str = (String) val; // Pick the first definition for affinity int index = str.indexOf(','); if (index > -1) { str = str.substring(0, index); } return str.trim(); } return null; }
/** * Check if the user has disabled affinity learning */ private boolean shouldLearnAffinity() { Object val = null; try { val = getEnvironment().get(EJBClient.DISABLE_AFFINITY_LEARNING); } catch(NamingException ne) { Logs.MAIN.warn("Problem reading cluster affinity specification from env; skipping affinity assignment"); } return val == null || "false".equalsIgnoreCase(val.toString()); }
private Endpoint getEndpoint(final FastHashtable<String, Object> env) { return env.containsKey(ENDPOINT) ? (Endpoint) env.get(ENDPOINT) : Endpoint.getCurrent(); } }
/** * Check if the user has specified strong affinity to a cluster for this context and return the cluster name. * @return String the name of the cluster */ private String getClusterAffinityValueFromEnvironment() { Object val; try { val = getEnvironment().get(EJBClient.CLUSTER_AFFINITY); if (val != null && val instanceof String) { return (String) val; } return getLegacyClusterAffinity(); } catch(NamingException ne) { Logs.MAIN.warn("Problem reading cluster affinity specification from env; skipping affinity assignment"); return null; } }
EJBRootContext(final NamingProvider namingProvider, final FastHashtable<String, Object> env, final ProviderEnvironment providerEnvironment) { super(env); this.namingProvider = namingProvider; this.providerEnvironment = providerEnvironment; // TODO, Switch to providerEnvironment using WildFLy Naming, when attachments are added Object learned = env.get(LEARNED_AFFINITY_KEY); if (learned == null || ! (learned instanceof LearnedAffinity)) { // check if strong affinity for this context has been set in the environment String clusterName = getClusterAffinityValueFromEnvironment(); if (clusterName != null) { learned = new LearnedAffinity(new ClusterAffinity(clusterName)); } else { learned = new LearnedAffinity(shouldLearnAffinity() ? null : Affinity.NONE); } env.put(LEARNED_AFFINITY_KEY, learned); } this.baseAffinity = (LearnedAffinity) learned; }
private String getLegacyClusterAffinity() throws NamingException { Object val = getEnvironment().get(JBossEJBProperties.PROPERTY_KEY_CLUSTERS); if (val != null && val instanceof String) { String str = (String) val; // Pick the first definition for affinity int index = str.indexOf(','); if (index > -1) { str = str.substring(0, index); } return str.trim(); } return null; }
private Long getLongValueFromEnvironment(String key) throws NamingException { Object val = getEnvironment().get(key); if (val != null && val instanceof String) { return Long.valueOf(Long.parseLong((String) val)); } return null; }
private Long getLongValueFromEnvironment(String key) throws NamingException { Object val = getEnvironment().get(key); if (val != null && val instanceof String) { return Long.valueOf(Long.parseLong((String) val)); } return null; }
private String getLegacyClusterAffinity() throws NamingException { Object val = getEnvironment().get(JBossEJBProperties.PROPERTY_KEY_CLUSTERS); if (val != null && val instanceof String) { String str = (String) val; // Pick the first definition for affinity int index = str.indexOf(','); if (index > -1) { str = str.substring(0, index); } return str.trim(); } return null; }
/** * Check if the user has disabled affinity learning */ private boolean shouldLearnAffinity() { Object val = null; try { val = getEnvironment().get(EJBClient.DISABLE_AFFINITY_LEARNING); } catch(NamingException ne) { Logs.MAIN.warn("Problem reading cluster affinity specification from env; skipping affinity assignment"); } return val == null || "false".equalsIgnoreCase(val.toString()); }
/** * Check if the user has disabled affinity learning */ private boolean shouldLearnAffinity() { Object val = null; try { val = getEnvironment().get(EJBClient.DISABLE_AFFINITY_LEARNING); } catch(NamingException ne) { Logs.MAIN.warn("Problem reading cluster affinity specification from env; skipping affinity assignment"); } return val == null || "false".equalsIgnoreCase(val.toString()); }
private Endpoint getEndpoint(final FastHashtable<String, Object> env) { return env.containsKey(ENDPOINT) ? (Endpoint) env.get(ENDPOINT) : Endpoint.getCurrent(); } }
private Endpoint getEndpoint(final FastHashtable<String, Object> env) { return env.containsKey(ENDPOINT) ? (Endpoint) env.get(ENDPOINT) : Endpoint.getCurrent(); } }
/** * Check if the user has specified strong affinity to a cluster for this context and return the cluster name. * @return String the name of the cluster */ private String getClusterAffinityValueFromEnvironment() { Object val; try { val = getEnvironment().get(EJBClient.CLUSTER_AFFINITY); if (val != null && val instanceof String) { return (String) val; } return getLegacyClusterAffinity(); } catch(NamingException ne) { Logs.MAIN.warn("Problem reading cluster affinity specification from env; skipping affinity assignment"); return null; } }
/** * Check if the user has specified strong affinity to a cluster for this context and return the cluster name. * @return String the name of the cluster */ private String getClusterAffinityValueFromEnvironment() { Object val; try { val = getEnvironment().get(EJBClient.CLUSTER_AFFINITY); if (val != null && val instanceof String) { return (String) val; } return getLegacyClusterAffinity(); } catch(NamingException ne) { Logs.MAIN.warn("Problem reading cluster affinity specification from env; skipping affinity assignment"); return null; } }
EJBRootContext(final NamingProvider namingProvider, final FastHashtable<String, Object> env, final ProviderEnvironment providerEnvironment) { super(env); this.namingProvider = namingProvider; this.providerEnvironment = providerEnvironment; // TODO, Switch to providerEnvironment using WildFLy Naming, when attachments are added Object learned = env.get(LEARNED_AFFINITY_KEY); if (learned == null || ! (learned instanceof LearnedAffinity)) { // check if strong affinity for this context has been set in the environment String clusterName = getClusterAffinityValueFromEnvironment(); if (clusterName != null) { learned = new LearnedAffinity(new ClusterAffinity(clusterName)); } else { learned = new LearnedAffinity(shouldLearnAffinity() ? null : Affinity.NONE); } env.put(LEARNED_AFFINITY_KEY, learned); } this.baseAffinity = (LearnedAffinity) learned; }
EJBRootContext(final NamingProvider namingProvider, final FastHashtable<String, Object> env, final ProviderEnvironment providerEnvironment) { super(env); this.namingProvider = namingProvider; this.providerEnvironment = providerEnvironment; // TODO, Switch to providerEnvironment using WildFLy Naming, when attachments are added Object learned = env.get(LEARNED_AFFINITY_KEY); if (learned == null || ! (learned instanceof LearnedAffinity)) { // check if strong affinity for this context has been set in the environment String clusterName = getClusterAffinityValueFromEnvironment(); if (clusterName != null) { learned = new LearnedAffinity(new ClusterAffinity(clusterName)); } else { learned = new LearnedAffinity(shouldLearnAffinity() ? null : Affinity.NONE); } env.put(LEARNED_AFFINITY_KEY, learned); } this.baseAffinity = (LearnedAffinity) learned; }