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

com.pamirs.pradar.upload.uploader.AgentOnlineUploader Maven / Gradle / Ivy

There is a newer version: 1.0.2
Show newest version
package com.pamirs.pradar.upload.uploader;

import com.pamirs.pradar.upload.HttpOnceUploader;
import com.pamirs.pradar.upload.info.AgentInfo;

/**
 * 应用启动时候,将 Agent、应用、机器等信息上报
 *
 * @author shiyajian
 * create: 2020-07-20
 */
public class AgentOnlineUploader extends HttpOnceUploader {

    public static final String UPLOADER_NAME = "agent_online_uploader";

    public static final String POST_URL = "api/smon/app/addAppInfo";

    public static final int RETRY_TIMES = -1;

    public static final int RETRY_SECOND = 10;

    private AgentOnlineUploader() {
        super(UPLOADER_NAME, POST_URL, RETRY_TIMES, RETRY_SECOND);
    }

    private static AgentOnlineUploader INSTANCE;

    public static AgentOnlineUploader getInstance() {
        if (INSTANCE == null) {
            synchronized (AgentOnlineUploader.class) {
                if (INSTANCE == null) {
                    INSTANCE = new AgentOnlineUploader();
                }
            }
        }
        return INSTANCE;
    }

    @Override
    public boolean enabled() {
        return true;
    }

    @Override
    protected String getData() {
        return AgentInfo.getInstance().toJson();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy