Methods Summary |
---|
private void | doLookups(java.util.Hashtable localEnv, org.jboss.logging.Logger tmsLog, java.util.ArrayList nodes)
for(int n = 0; n < nodes.size(); n ++)
{
AddressPort addrInfo = (AddressPort) nodes.get(n);
String providerURL = urlPrefix + addrInfo.getHostName() + urlSuffix;
Hashtable env = new Hashtable(localEnv);
env.put(Context.PROVIDER_URL, providerURL);
tmsLog.info("Checking names on: "+addrInfo);
try
{
InitialContext ctx = new InitialContext(env);
for(int s = 0; s < lookupNames.length; s ++)
{
String name = lookupNames[s];
Object value = ctx.lookup(name);
tmsLog.info("lookup("+name+"): "+value);
}
}
catch(Exception e)
{
tmsLog.error("Failed lookups on: "+addrInfo, e);
}
}
|
public java.lang.String[] | getLookupNames()Get the names of JNDI bindings that should be queried on each host
return lookupNames;
|
public java.lang.String | getProviderURLPattern()Get the Context.PROVIDER_URL regular expression.
return urlPattern;
|
public void | membershipChanged(java.util.ArrayList removed, java.util.ArrayList added, java.util.ArrayList members, java.lang.String logCategoryName)The TopologyMonitorService trigger callback operation.
log.debug("membershipChanged");
Logger tmsLog = Logger.getLogger(logCategoryName);
Hashtable localEnv = null;
try
{
InitialContext localCtx = new InitialContext();
localEnv = localCtx.getEnvironment();
}
catch(NamingException e)
{
tmsLog.error("Failed to obtain InitialContext env", e);
return;
}
tmsLog.info("Checking removed hosts JNDI binding");
doLookups(localEnv, tmsLog, removed);
tmsLog.info("Checking added hosts JNDI binding");
doLookups(localEnv, tmsLog, added);
tmsLog.info("Checking members hosts JNDI binding");
doLookups(localEnv, tmsLog, members);
|
public void | setLookupNames(java.lang.String[] names)Set the names of JNDI bindings that should be queried on each host
this.lookupNames = names;
|
public void | setProviderURLPattern(java.lang.String regex)Set the regular expression containing the hostname/IP address of
the JNDI provider. This expression is used to build the JNDI
Context.PROVIDER_URL for each node in the cluster. The expression
should contain a "(host)" component that will be replaced with the
cluster node hostname.
this.urlPattern = regex;
this.urlPrefix = regex;
this.urlSuffix = "";
String hostExp = "{host}";
int hostIndex = regex.indexOf(hostExp);
if( hostIndex >= 0 )
{
urlPrefix = regex.substring(0, hostIndex);
int endIndex = hostIndex + hostExp.length();
urlSuffix = regex.substring(endIndex);
}
|