use of org.bimserver.shared.pb.ServiceMethodNotFoundException in project BIMserver by opensourceBIM.
the class Handler method run.
@Override
public void run() {
running = true;
try {
DataInputStream dis = new DataInputStream(socket.getInputStream());
String token = dis.readUTF();
ReflectiveRpcChannel reflectiveRpcChannel = new ReflectiveRpcChannel(ServiceInterface.class, serviceFactory.get(token, AccessMethod.INTERNAL).get(ServiceInterface.class), protocolBuffersMetaData, servicesMap);
while (running) {
String serviceName = dis.readUTF();
String methodName = dis.readUTF();
MethodDescriptorContainer methodDescriptorContainer;
try {
methodDescriptorContainer = protocolBuffersMetaData.getMethod(serviceName, methodName);
Builder newBuilder = DynamicMessage.newBuilder(methodDescriptorContainer.getInputDescriptor());
newBuilder.mergeDelimitedFrom(dis);
DynamicMessage request = newBuilder.build();
Message response = reflectiveRpcChannel.callBlockingMethod(methodDescriptorContainer, request);
response.writeDelimitedTo(socket.getOutputStream());
} catch (ServiceNotFoundException e) {
// TODO should return a usable pb message for the user
LOGGER.error("", e);
} catch (ServiceMethodNotFoundException e) {
// TODO should return a usable pb message for the user
LOGGER.error("", e);
}
}
} catch (IOException e) {
LOGGER.error("", e);
} catch (UserException e) {
LOGGER.error("", e);
}
socketNotificationsClient.notifyDisconnect();
}
Aggregations