X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ms%2Fblueprintsprocessor%2Fmodules%2Finbounds%2Fselfservice-api%2Fsrc%2Fmain%2Fkotlin%2Forg%2Fonap%2Fccsdk%2Fcds%2Fblueprintsprocessor%2Fselfservice%2Fapi%2FBluePrintProcessingGRPCHandler.kt;h=305437923ad6cbcb2fc53f55d4862922af98cf9c;hb=341db21b2ac0a14a1ed2b8bf7930914dda054bfe;hp=b25acd148758c5df61fd14e5606757a87d79cb0f;hpb=d274e5fc552cf9ae25500f504f0434981cf3accf;p=ccsdk%2Fcds.git diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandler.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandler.kt index b25acd148..305437923 100644 --- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandler.kt +++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandler.kt @@ -31,16 +31,20 @@ import java.util.concurrent.Phaser import javax.annotation.PreDestroy @Service -open class BluePrintProcessingGRPCHandler(private val bluePrintCoreConfiguration: BluePrintCoreConfiguration, - private val executionServiceHandler: ExecutionServiceHandler) - : BluePrintProcessingServiceGrpc.BluePrintProcessingServiceImplBase() { +open class BluePrintProcessingGRPCHandler( + private val bluePrintCoreConfiguration: BluePrintCoreConfiguration, + private val executionServiceHandler: ExecutionServiceHandler +) : + BluePrintProcessingServiceGrpc.BluePrintProcessingServiceImplBase() { + private val log = LoggerFactory.getLogger(BluePrintProcessingGRPCHandler::class.java) private val ph = Phaser(1) @PreAuthorize("hasRole('USER')") override fun process( - responseObserver: StreamObserver): StreamObserver { + responseObserver: StreamObserver + ): StreamObserver { return object : StreamObserver { override fun onNext(executionServiceInput: ExecutionServiceInput) { @@ -51,17 +55,18 @@ open class BluePrintProcessingGRPCHandler(private val bluePrintCoreConfiguration } } catch (e: Exception) { onError(e) - } - finally { + } finally { ph.arriveAndDeregister() } } override fun onError(error: Throwable) { log.debug("Fail to process message", error) - responseObserver.onError(io.grpc.Status.INTERNAL + responseObserver.onError( + io.grpc.Status.INTERNAL .withDescription(error.message) - .asException()) + .asException() + ) } override fun onCompleted() { @@ -77,4 +82,4 @@ open class BluePrintProcessingGRPCHandler(private val bluePrintCoreConfiguration ph.arriveAndAwaitAdvance() log.info("Done waiting in $name") } -} \ No newline at end of file +}