Search in sources :

Example 1 with ServiceType

use of alluxio.grpc.ServiceType in project alluxio by Alluxio.

the class DefaultFileSystemMaster method getServices.

@Override
public Map<ServiceType, GrpcService> getServices() {
    Map<ServiceType, GrpcService> services = new HashMap<>();
    services.put(ServiceType.FILE_SYSTEM_MASTER_CLIENT_SERVICE, new GrpcService(ServerInterceptors.intercept(new FileSystemMasterClientServiceHandler(this), new ClientIpAddressInjector())));
    services.put(ServiceType.FILE_SYSTEM_MASTER_JOB_SERVICE, new GrpcService(new FileSystemMasterJobServiceHandler(this)));
    services.put(ServiceType.FILE_SYSTEM_MASTER_WORKER_SERVICE, new GrpcService(new FileSystemMasterWorkerServiceHandler(this)));
    return services;
}
Also used : GrpcService(alluxio.grpc.GrpcService) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) ServiceType(alluxio.grpc.ServiceType) ClientIpAddressInjector(alluxio.security.authentication.ClientIpAddressInjector)

Example 2 with ServiceType

use of alluxio.grpc.ServiceType in project alluxio by Alluxio.

the class DefaultMetricsMaster method getServices.

@Override
public Map<ServiceType, GrpcService> getServices() {
    Map<ServiceType, GrpcService> services = new HashMap<>();
    services.put(ServiceType.METRICS_MASTER_CLIENT_SERVICE, new GrpcService(getMasterServiceHandler()));
    return services;
}
Also used : GrpcService(alluxio.grpc.GrpcService) HashMap(java.util.HashMap) ServiceType(alluxio.grpc.ServiceType)

Example 3 with ServiceType

use of alluxio.grpc.ServiceType in project alluxio by Alluxio.

the class MasterHealthCheckClient method isServing.

@Override
public boolean isServing() {
    try {
        ServiceType rpcService;
        InetSocketAddress connectAddr;
        switch(mAlluxioMasterType) {
            case MASTER:
                rpcService = ServiceType.FILE_SYSTEM_MASTER_CLIENT_SERVICE;
                connectAddr = NetworkAddressUtils.getConnectAddress(NetworkAddressUtils.ServiceType.MASTER_RPC, mConf);
                break;
            case JOB_MASTER:
                rpcService = ServiceType.JOB_MASTER_CLIENT_SERVICE;
                connectAddr = NetworkAddressUtils.getConnectAddress(NetworkAddressUtils.ServiceType.JOB_MASTER_RPC, mConf);
                break;
            default:
                throw new IllegalArgumentException(String.format("Master type %s is invalid", mAlluxioMasterType));
        }
        MasterServingHealthCheck masterRpcCheck = new MasterServingHealthCheck(connectAddr, rpcService, mPolicySupplier, mConf);
        Future<?> masterServingFuture = mExecutorService.submit(masterRpcCheck);
        if (mProcessCheck) {
            Future<?> processCheckFuture = mExecutorService.submit(new ProcessCheckRunnable(mAlluxioMasterType.getClassName()));
            CommonUtils.sleepMs(Constants.SECOND_MS);
            // If in HA mode, can't check the RPC service, because the service may not have started
            if (!ConfigurationUtils.isHaMode(mConf)) {
                while (!masterServingFuture.isDone()) {
                    if (processCheckFuture.isDone()) {
                        throw new IllegalStateException("One or more master processes are not running");
                    }
                    CommonUtils.sleepMs(Constants.SECOND_MS);
                }
            }
            // Check after a 7 second period if the process is is still alive
            CommonUtils.sleepMs(7L * Constants.SECOND_MS);
            LOG.debug("Checking the master processes one more time...");
            return !processCheckFuture.isDone();
        } else {
            masterServingFuture.get();
            return masterRpcCheck.serving();
        }
    } catch (Exception e) {
        LOG.error("Exception thrown in master health check client", e);
    } finally {
        mExecutorService.shutdown();
    }
    return false;
}
Also used : ServiceType(alluxio.grpc.ServiceType) InetSocketAddress(java.net.InetSocketAddress)

Example 4 with ServiceType

use of alluxio.grpc.ServiceType in project alluxio by Alluxio.

the class RaftJournalSystem method getJournalServices.

@Override
public synchronized Map<ServiceType, GrpcService> getJournalServices() {
    Map<ServiceType, GrpcService> services = new HashMap<>();
    services.put(ServiceType.RAFT_JOURNAL_SERVICE, new GrpcService(new RaftJournalServiceHandler(mStateMachine.getSnapshotReplicationManager())));
    return services;
}
Also used : GrpcService(alluxio.grpc.GrpcService) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) ServiceType(alluxio.grpc.ServiceType)

Example 5 with ServiceType

use of alluxio.grpc.ServiceType in project alluxio by Alluxio.

the class DefaultBlockMaster method getServices.

@Override
public Map<ServiceType, GrpcService> getServices() {
    Map<ServiceType, GrpcService> services = new HashMap<>();
    services.put(ServiceType.BLOCK_MASTER_CLIENT_SERVICE, new GrpcService(new BlockMasterClientServiceHandler(this)));
    services.put(ServiceType.BLOCK_MASTER_WORKER_SERVICE, new GrpcService(new BlockMasterWorkerServiceHandler(this)));
    return services;
}
Also used : GrpcService(alluxio.grpc.GrpcService) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) ServiceType(alluxio.grpc.ServiceType)

Aggregations

ServiceType (alluxio.grpc.ServiceType)9 GrpcService (alluxio.grpc.GrpcService)7 HashMap (java.util.HashMap)6 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)3 InetSocketAddress (java.net.InetSocketAddress)2 GrpcChannel (alluxio.grpc.GrpcChannel)1 ServiceVersionClientServiceGrpc (alluxio.grpc.ServiceVersionClientServiceGrpc)1 ClientIpAddressInjector (alluxio.security.authentication.ClientIpAddressInjector)1 StatusRuntimeException (io.grpc.StatusRuntimeException)1