1001804 Issue about cache with load balancer. List members in the cluster in About window.
This commit is contained in:
parent
8e39f76d96
commit
4d6203f007
|
@ -23,6 +23,7 @@ import java.net.InetAddress;
|
|||
import java.sql.DriverManager;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
@ -35,9 +36,12 @@ import java.util.logging.Level;
|
|||
import java.util.logging.LogManager;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.adempiere.base.Service;
|
||||
import org.compiere.Adempiere;
|
||||
import org.compiere.db.CConnection;
|
||||
import org.compiere.model.MClient;
|
||||
import org.idempiere.distributed.IClusterMember;
|
||||
import org.idempiere.distributed.IClusterService;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -542,6 +546,24 @@ public class CLogMgt
|
|||
//thread info
|
||||
sb.append("Active Threads = " + Thread.activeCount());
|
||||
//
|
||||
//cluster info
|
||||
if (Env.getAD_Client_ID(Env.getCtx()) == 0) {
|
||||
IClusterService service = Service.locator().locate(IClusterService.class).getService();
|
||||
if (service != null) {
|
||||
IClusterMember local = service.getLocalMember();
|
||||
Collection<IClusterMember> members = service.getMembers();
|
||||
if (!members.isEmpty())
|
||||
sb.append(NL).append("Cluster Nodes:").append(NL);
|
||||
for(IClusterMember member : members) {
|
||||
sb.append(member.toString());
|
||||
if (local != null && member.getId().equals(local.getId())) {
|
||||
sb.append(" *");
|
||||
}
|
||||
sb.append(NL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sb;
|
||||
} // getInfo
|
||||
|
||||
|
|
|
@ -5,4 +5,5 @@ import java.net.InetAddress;
|
|||
public interface IClusterMember {
|
||||
public String getId();
|
||||
public InetAddress getAddress();
|
||||
public int getPort();
|
||||
}
|
||||
|
|
|
@ -25,14 +25,16 @@ public class ClusterMember implements IClusterMember {
|
|||
|
||||
private String id;
|
||||
private InetAddress address;
|
||||
private int port;
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @param address
|
||||
*/
|
||||
public ClusterMember(String id, InetAddress address) {
|
||||
public ClusterMember(String id, InetAddress address, int port) {
|
||||
this.id = id;
|
||||
this.address = address;
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -51,4 +53,15 @@ public class ClusterMember implements IClusterMember {
|
|||
return address;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getAddress().getHostAddress()+":"+getPort()+" "+id;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public class ClusterServiceImpl implements IClusterService {
|
|||
Set<Member> members = Activator.getHazelcastInstance().getCluster().getMembers();
|
||||
Set<IClusterMember> clusterMembers = new HashSet<IClusterMember>();
|
||||
for(Member member : members) {
|
||||
clusterMembers.add(new ClusterMember(member.getUuid(), member.getInetSocketAddress().getAddress()));
|
||||
clusterMembers.add(new ClusterMember(member.getUuid(), member.getInetSocketAddress().getAddress(), member.getInetSocketAddress().getPort()));
|
||||
}
|
||||
return clusterMembers;
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public class ClusterServiceImpl implements IClusterService {
|
|||
@Override
|
||||
public IClusterMember getLocalMember() {
|
||||
Member member = Activator.getHazelcastInstance().getCluster().getLocalMember();
|
||||
return new ClusterMember(member.getUuid(), member.getInetSocketAddress().getAddress());
|
||||
return new ClusterMember(member.getUuid(), member.getInetSocketAddress().getAddress(), member.getInetSocketAddress().getPort());
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
Loading…
Reference in New Issue