Search in sources :

Example 1 with GatewaySender

use of org.apache.geode.tools.pulse.internal.data.Cluster.GatewaySender in project geode by apache.

the class PropMockDataUpdater method createGatewaySenderCount.

private GatewaySender createGatewaySenderCount(Random r) {
    GatewaySender gatewaySender = new GatewaySender();
    gatewaySender.setBatchSize(Math.abs(r.nextInt(10)));
    gatewaySender.setId(String.valueOf(Math.abs(r.nextInt(10))));
    gatewaySender.setLinkThroughput(Math.abs(r.nextInt(10)));
    gatewaySender.setPersistenceEnabled(true);
    gatewaySender.setPrimary(true);
    gatewaySender.setQueueSize(Math.abs(r.nextInt(10)));
    gatewaySender.setSenderType(false);
    gatewaySender.setStatus(true);
    return gatewaySender;
}
Also used : GatewaySender(org.apache.geode.tools.pulse.internal.data.Cluster.GatewaySender)

Example 2 with GatewaySender

use of org.apache.geode.tools.pulse.internal.data.Cluster.GatewaySender 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;
}
Also used : GatewaySender(org.apache.geode.tools.pulse.internal.data.Cluster.GatewaySender) Random(java.util.Random) ArrayList(java.util.ArrayList) GatewayReceiver(org.apache.geode.tools.pulse.internal.data.Cluster.GatewayReceiver) ArrayList(java.util.ArrayList) List(java.util.List) Member(org.apache.geode.tools.pulse.internal.data.Cluster.Member)

Aggregations

GatewaySender (org.apache.geode.tools.pulse.internal.data.Cluster.GatewaySender)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Random (java.util.Random)1 GatewayReceiver (org.apache.geode.tools.pulse.internal.data.Cluster.GatewayReceiver)1 Member (org.apache.geode.tools.pulse.internal.data.Cluster.Member)1