static OcAgentMetricsServiceExportRpcHandler create ( MetricsServiceStub stub ) { OcAgentMetricsServiceExportRpcHandler exportRpcHandler = new OcAgentMetricsServiceExportRpcHandler ( ) ; ExportResponseObserver exportResponseObserver = new ExportResponseObserver ( exportRpcHandler ) ; try { StreamObserver < ExportMetricsServiceRequest > exportRequestObserver = stub . export ( exportResponseObserver ) ; exportRpcHandler . setExportRequestObserver ( exportRequestObserver ) ; } catch ( StatusRuntimeException e ) { exportRpcHandler . onComplete ( e ) ; } return exportRpcHandler ; }
given MetricsServiceStub .