Search in sources :

Example 1 with LocalMaster

use of com.tencent.angel.localcluster.LocalMaster in project angel by Tencent.

the class AngelLocalClient method updateMaster.

@Override
protected void updateMaster(int maxWaitSeconds) throws Exception {
    int tryTime = 0;
    TConnection connection = TConnectionManager.getConnection(conf);
    while (tryTime < maxWaitSeconds) {
        LocalMaster localMaster = LocalClusterContext.get().getMaster();
        if (localMaster == null || localMaster.getAppMaster().getAppContext().getMasterService() == null) {
            Thread.sleep(1000);
            tryTime++;
            continue;
        }
        masterLocation = localMaster.getAppMaster().getAppContext().getMasterService().getLocation();
        if (masterLocation == null) {
            Thread.sleep(1000);
            tryTime++;
            continue;
        }
        try {
            LOG.info("start to create rpc client to am");
            master = connection.getMasterService(masterLocation.getIp(), masterLocation.getPort());
            startHeartbeat();
            break;
        } catch (ServiceException e) {
            Thread.sleep(1000);
            tryTime++;
        }
    }
}
Also used : TConnection(com.tencent.angel.ipc.TConnection) LocalMaster(com.tencent.angel.localcluster.LocalMaster) ServiceException(com.google.protobuf.ServiceException)

Aggregations

ServiceException (com.google.protobuf.ServiceException)1 TConnection (com.tencent.angel.ipc.TConnection)1 LocalMaster (com.tencent.angel.localcluster.LocalMaster)1