All Downloads are FREE. Search and download functionalities are using the official Maven repository.

Alachisoft.NCache.Sessions.MetricsSessions.BridgeSession Maven / Gradle / Ivy

The newest version!
package Alachisoft.NCache.Sessions.MetricsSessions;

import Alachisoft.NCache.DataModel.Bridge;
import Alachisoft.NCache.DataModel.CounterData;
import Alachisoft.NCache.MetricServer.MetricPublisher;
import Alachisoft.NCache.Sessions.MetricsSession;

import java.util.ArrayList;
import java.util.List;

public class BridgeSession extends MetricsSession {

    private Bridge bridge;
    private String bridgeconfigId;
    private String bridgeName;

    public BridgeSession(String sessionId, Bridge bridge) {
        super(sessionId, MetricPublisher.Bridge, "");
        this.bridge = bridge;
        this.bridgeconfigId = bridge.getBridgeConfigId();
        this.bridgeName = bridge.getBridgeName();
        bridge.setSessionId(sessionId);
    }

    public BridgeSession(String sessionId, String bridgeconfigId, String bridgeName) {
        super(sessionId, MetricPublisher.Bridge, "");
        this.bridgeconfigId = bridgeconfigId;
        this.bridgeName = bridgeName;
    }

    @Override
    public void publishMetric(String instanceName, CounterData counterData) {
        try {
            metricsAgentManager.publishCounterData(instanceName, counterData, getParamsList());
        } catch (Exception e) {
            getLogger().Error("MetricServer", e.toString());
        }
    }

    @Override
    protected List getParamsList() {
        List list = new ArrayList<>();
        list.add(bridgeName);
        list.add(bridgeconfigId);
        list.add(bridge.getServer());
        list.add(Boolean.toString(bridge.isReplica()));
        return list;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy