Search in sources :

Example 1 with RoleType

use of com.alibaba.maxgraph.proto.RoleType in project GraphScope by alibaba.

the class Frontend method startHBThread.

protected void startHBThread() {
    hbSchedule = new ScheduledThreadPoolExecutor(1, CommonUtil.createFactoryWithDefaultExceptionHandler("HB_THREAD", LOG));
    hbSchedule.scheduleWithFixedDelay(() -> {
        if (clientManager.isCoordinatorRelatedClientNotReady()) {
            LOG.info("wait am ready.");
        } else {
            try {
                LOG.info("send hb {} to am", endpoint);
                Map<RoleType, Map<Integer, Endpoint>> workerInfoMap = clientManager.getServerDataApiClient().workerHeartbeat(instanceConfig.getServerId(), endpoint, RoleType.FRONTEND, CommonUtil.getYarnLogDir(), this.aliveId, this.roleId);
                updateWorkerConnection(workerInfoMap);
            } catch (Exception e) {
                LOG.error("register to am failed:{}", e);
            }
        }
    }, 1, instanceConfig.getFrontendAmHbIntervalSeconds(), TimeUnit.SECONDS);
}
Also used : ScheduledThreadPoolExecutor(java.util.concurrent.ScheduledThreadPoolExecutor) RoleType(com.alibaba.maxgraph.proto.RoleType) Map(java.util.Map)

Aggregations

RoleType (com.alibaba.maxgraph.proto.RoleType)1 Map (java.util.Map)1 ScheduledThreadPoolExecutor (java.util.concurrent.ScheduledThreadPoolExecutor)1