InitialContext ctx = new InitialContext(env);
String partitionName = env.getProperty(NamingContext.JNP_PARTITION_NAME);
if( partitionName != null )
{
String partitionJndiName = "/HAPartition/" + partitionName;
HAPartition partition = (HAPartition) ctx.lookup(partitionJndiName);
Vector view = partition.getCurrentView();
log.debug("Found HAPartition: "+partitionName);
hosts = new String[view.size()];
for(int v = 0; v < view.size(); v ++)
{
Object addr = view.get(v);
log.debug(addr);
hosts[v] = addr.toString();
}
}
else
{
NamingEnumeration iter = ctx.list("/HAPartition");
while( iter.hasMore() )
{
NameClassPair pair = (NameClassPair) iter.next();
partitionName = pair.getName();
String partitionJndiName = "/HAPartition/" + partitionName;
HAPartition partition = (HAPartition) ctx.lookup(partitionJndiName);
env.setProperty(NamingContext.JNP_PARTITION_NAME, partitionName);
Vector view = partition.getCurrentView();
log.debug("Found HAPartition: "+partitionName);
hosts = new String[view.size()];
for(int v = 0; v < view.size(); v ++)
{
Object addr = view.get(v);