use of alluxio.hub.manager.rpc.observer.RequestStreamObserver in project alluxio by Alluxio.
the class ManagerProcessContext method startProcessStatusChangeListener.
/**
* Starts a request stream observer for {@link HostedManagerServiceGrpc} ProcessStatusChange
* RPC calls.
*/
public void startProcessStatusChangeListener() {
HostedManagerServiceGrpc.HostedManagerServiceStub asyncStub = getHostedAsyncStub();
RequestStreamObserver requestObserver = new RequestStreamObserver<ProcessStatusChangeRequest, ProcessStatusChangeResponse>() {
@Override
public ProcessStatusChangeResponse exec(ProcessStatusChangeRequest req) {
return ProcessStatusChangeResponse.newBuilder().setHubMetadata(mHubMetadata).setPayload(ProcessStatusChangeResponse.Payload.newBuilder().addAllProcessStatusChangeResponse(processStatusChange(req))).build();
}
@Override
public void restart() {
startProcessStatusChangeListener();
}
@Override
public void handleError(String message, Throwable t) {
handleStatusRuntimeException(message, t);
}
};
StreamObserver<ProcessStatusChangeResponse> responseObserver = asyncStub.processStatusChange(requestObserver);
requestObserver.start(responseObserver, ProcessStatusChangeResponse.newBuilder().setHubMetadata(mHubMetadata).build());
LOG.info("Started ProcessStatusChange async listener", asyncStub);
}
use of alluxio.hub.manager.rpc.observer.RequestStreamObserver in project alluxio by Alluxio.
the class ManagerProcessContext method startGetPrestoConfDirListener.
/**
* Starts a request stream observer for {@link HostedManagerServiceGrpc} GetPrestoConfDir
* RPC calls.
*/
public void startGetPrestoConfDirListener() {
HostedManagerServiceGrpc.HostedManagerServiceStub asyncStub = getHostedAsyncStub();
RequestStreamObserver requestObserver = new RequestStreamObserver<GetPrestoConfDirRequest, GetPrestoConfDirResponse>() {
@Override
public GetPrestoConfDirResponse exec(GetPrestoConfDirRequest req) {
return GetPrestoConfDirResponse.newBuilder().setHubMetadata(mHubMetadata).setPayload(getPrestoConf()).build();
}
@Override
public void restart() {
startGetPrestoConfDirListener();
}
@Override
public void handleError(String message, Throwable t) {
handleStatusRuntimeException(message, t);
}
};
StreamObserver<GetPrestoConfDirResponse> responseObserver = asyncStub.getPrestoConfDir(requestObserver);
requestObserver.start(responseObserver, GetPrestoConfDirResponse.newBuilder().setHubMetadata(mHubMetadata).build());
LOG.info("Started GetPrestoConfDir async listener", asyncStub);
}
use of alluxio.hub.manager.rpc.observer.RequestStreamObserver in project alluxio by Alluxio.
the class ManagerProcessContext method startListCatalogListener.
/**
* Starts a request stream observer for {@link HostedManagerServiceGrpc} ListCatalog RPC calls.
*/
public void startListCatalogListener() {
HostedManagerServiceGrpc.HostedManagerServiceStub asyncStub = getHostedAsyncStub();
RequestStreamObserver requestObserver = new RequestStreamObserver<ListCatalogRequest, ListCatalogResponse>() {
@Override
public ListCatalogResponse exec(ListCatalogRequest req) {
PrestoCatalogListingResult result = listCatalogs(getUpdatedProps(configurationSetFor(AlluxioNodeType.MASTER)).getString(PropertyKey.HUB_MANAGER_PRESTO_CONF_PATH));
return ListCatalogResponse.newBuilder().setHubMetadata(mHubMetadata).setPayload(ListCatalogResponse.Payload.newBuilder().addAllCatalog(result.getCatalogList())).build();
}
@Override
public void restart() {
startListCatalogListener();
}
@Override
public void handleError(String message, Throwable t) {
handleStatusRuntimeException(message, t);
}
};
StreamObserver<ListCatalogResponse> responseObserver = asyncStub.listCatalog(requestObserver);
requestObserver.start(responseObserver, ListCatalogResponse.newBuilder().setHubMetadata(mHubMetadata).build());
LOG.info("Started ListCatalog async listener", asyncStub);
}
use of alluxio.hub.manager.rpc.observer.RequestStreamObserver in project alluxio by Alluxio.
the class ManagerProcessContext method startGetConfigurationSetListener.
/**
* Starts a request stream observer for {@link HostedManagerServiceGrpc} GetConfigurationSet
* RPC calls.
*/
public void startGetConfigurationSetListener() {
HostedManagerServiceGrpc.HostedManagerServiceStub asyncStub = getHostedAsyncStub();
RequestStreamObserver requestObserver = new RequestStreamObserver<GetConfigurationSetRequest, GetConfigurationSetResponse>() {
@Override
public GetConfigurationSetResponse exec(GetConfigurationSetRequest req) {
AlluxioConfigurationSet confSet = configurationSetFor(req.getPayload().getNodeType());
return GetConfigurationSetResponse.newBuilder().setHubMetadata(mHubMetadata).setPayload(GetConfigurationSetResponse.Payload.newBuilder().setConfSet(confSet).build()).build();
}
@Override
public void restart() {
startGetConfigurationSetListener();
}
@Override
public void handleError(String message, Throwable t) {
handleStatusRuntimeException(message, t);
}
};
StreamObserver<GetConfigurationSetResponse> responseObserver = asyncStub.getConfigurationSet(requestObserver);
requestObserver.start(responseObserver, GetConfigurationSetResponse.newBuilder().setHubMetadata(mHubMetadata).build());
LOG.info("Started GetConfigurationSet async listener", asyncStub);
}
use of alluxio.hub.manager.rpc.observer.RequestStreamObserver in project alluxio by Alluxio.
the class ManagerProcessContext method startListFileListener.
/**
* Starts a request stream observer for {@link HostedManagerServiceGrpc} ListFile RPC calls.
*/
public void startListFileListener() {
HostedManagerServiceGrpc.HostedManagerServiceStub asyncStub = getHostedAsyncStub();
RequestStreamObserver requestObserver = new RequestStreamObserver<ListFileRequest, ListFileResponse>() {
@Override
public ListFileResponse exec(ListFileRequest req) {
return ListFileResponse.newBuilder().setHubMetadata(mHubMetadata).setPayload(ListFileResponse.Payload.newBuilder().addAllFile(listFiles())).build();
}
@Override
public void restart() {
startListFileListener();
}
@Override
public void handleError(String message, Throwable t) {
handleStatusRuntimeException(message, t);
}
};
StreamObserver<ListFileResponse> responseObserver = asyncStub.listFile(requestObserver);
requestObserver.start(responseObserver, ListFileResponse.newBuilder().setHubMetadata(mHubMetadata).build());
LOG.info("Started ListFile async listener", asyncStub);
}
Aggregations