{
NetworkInstance netInstance = instances[x];
ServerInvokerMetadata[] metadata = netInstance.getServerInvokers();
for (int i = 0; i < metadata.length; i++)
{
ServerInvokerMetadata data = metadata[i];
String[] subsystems = data.getSubSystems();
for (int z = 0; z < subsystems.length; z++)
{
if (subSystem.equalsIgnoreCase(subsystems[z]))
{
availableList.add(data);
}
}
}
}
//If alternative servers are found
if (availableList.size() > 0)
{
int index = loadBalancer.selectServer(availableList);
if (log.isDebugEnabled())
{
log.debug("Total of " + availableList.size() + " available servers found.");
log.debug("Using server number " + index);
}
//reconnect to the new server
ServerInvokerMetadata data = (ServerInvokerMetadata) availableList.get(index);
InvokerLocator newLocator = data.getInvokerLocator();
if (!remotingClient.getInvoker().getLocator().equals(newLocator))
{
try
{