From c7de906011f490d4f5bc61ba9177145c7f96dfba Mon Sep 17 00:00:00 2001 From: Oleksii Moskalenko Date: Mon, 9 Nov 2020 19:21:28 +0800 Subject: [PATCH] fix stencil client serialization Signed-off-by: Oleksii Moskalenko --- .../registry/proto/StencilProtoRegistry.scala | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/spark/ingestion/src/main/scala/feast/ingestion/registry/proto/StencilProtoRegistry.scala b/spark/ingestion/src/main/scala/feast/ingestion/registry/proto/StencilProtoRegistry.scala index 355ea0c0a5..4da552e23f 100644 --- a/spark/ingestion/src/main/scala/feast/ingestion/registry/proto/StencilProtoRegistry.scala +++ b/spark/ingestion/src/main/scala/feast/ingestion/registry/proto/StencilProtoRegistry.scala @@ -22,9 +22,15 @@ import com.gojek.de.stencil.StencilClientFactory import com.gojek.de.stencil.client.StencilClient class StencilProtoRegistry(val url: String) extends ProtoRegistry { + @transient + private var _stencilClient: StencilClient = _ - val stencilClient: StencilClient = - StencilClientFactory.getClient(url, Collections.emptyMap[String, String]) + def stencilClient: StencilClient = { + if (_stencilClient == null) { + _stencilClient = StencilClientFactory.getClient(url, Collections.emptyMap[String, String]) + } + _stencilClient + } override def getProtoDescriptor(className: String): Descriptors.Descriptor = { stencilClient.get(className)