use of org.apache.geode.tools.pulse.internal.data.Cluster.GatewayReceiver in project geode by apache.
the class PropMockDataUpdater method initializeMember.
private Member initializeMember(String id, String name, boolean manager, boolean isCache, boolean isLocator, boolean isServer, String host) {
Member m = new Member();
m.setId(id);
m.setName(name);
// m.setHost(getHostName(System.currentTimeMillis()));
m.setHost(host);
m.setMaxHeapSize(247);
Random r = new Random(System.currentTimeMillis());
m.setCache(isCache);
m.setLocator(isLocator);
m.setServer(isServer);
m.setManager(manager);
m.setLoadAverage((double) Math.abs(r.nextInt(100)));
m.setNumThreads(Math.abs(r.nextInt(100)));
m.setGarbageCollectionCount((long) Math.abs(r.nextInt(100)));
m.getGarbageCollectionSamples().add(m.getGarbageCollectionCount());
m.setTotalFileDescriptorOpen((long) Math.abs(r.nextInt(100)));
m.setTotalDiskUsage(Math.abs(r.nextInt(100)));
m.setThroughputWrites(Math.abs(r.nextInt(10)));
m.getThroughputWritesTrend().add(m.getThroughputWrites());
GatewayReceiver gatewayReceiver = m.getGatewayReceiver();
String port = cluster.getPort();
if (port == null || "".equals(port))
port = "1099";
gatewayReceiver.setListeningPort(Integer.parseInt(port));
gatewayReceiver.setLinkThroughput(Math.abs(r.nextInt(10)));
gatewayReceiver.setAvgBatchProcessingTime((long) Math.abs(r.nextInt(10)));
gatewayReceiver.setId(String.valueOf(Math.abs(r.nextInt(10))));
gatewayReceiver.setQueueSize(Math.abs(r.nextInt(10)));
gatewayReceiver.setStatus(true);
gatewayReceiver.setBatchSize(Math.abs(r.nextInt(10)));
int gatewaySenderCount = Math.abs(r.nextInt(10));
List<GatewaySender> list = m.getGatewaySenderList();
for (int i = 0; i < gatewaySenderCount; i++) {
list.add(createGatewaySenderCount(r));
}
Map<String, List<Member>> physicalToMember = cluster.getPhysicalToMember();
List<Cluster.Member> memberArrList = physicalToMember.get(m.getHost());
if (memberArrList != null) {
memberArrList.add(m);
} else {
ArrayList<Cluster.Member> memberList = new ArrayList<>();
memberList.add(m);
physicalToMember.put(m.getHost(), memberList);
}
int memberCount = cluster.getMemberCount();
memberCount++;
cluster.setMemberCount(memberCount);
return m;
}
Aggregations