From 21e4b6fe069712f320faf98df017b25e7e346cb8 Mon Sep 17 00:00:00 2001 From: pmadrigal Date: Tue, 7 Mar 2017 13:10:07 +0100 Subject: [PATCH] fix read config from path. We were mixing config path with zookeeper path fix lockpath and add repository visibility --- .../repository/impl/ZookeeperRepositoryComponent.scala | 2 +- .../impl/ZookeeperRepositoryWithTransactionsComponent.scala | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/scala/com/stratio/common/utils/components/repository/impl/ZookeeperRepositoryComponent.scala b/src/main/scala/com/stratio/common/utils/components/repository/impl/ZookeeperRepositoryComponent.scala index 59a5531..1332d44 100644 --- a/src/main/scala/com/stratio/common/utils/components/repository/impl/ZookeeperRepositoryComponent.scala +++ b/src/main/scala/com/stratio/common/utils/components/repository/impl/ZookeeperRepositoryComponent.scala @@ -111,7 +111,7 @@ trait ZookeeperRepositoryComponent extends RepositoryComponent[String, Array[Byt ) def getZookeeperConfig: Config = { - config.getConfig(path.getOrElse(ConfigZookeeper)) + config.getConfig(ConfigZookeeper) .getOrElse(throw new ZookeeperRepositoryException(s"Zookeeper config not found")) } diff --git a/src/main/scala/com/stratio/common/utils/components/transaction_manager/impl/ZookeeperRepositoryWithTransactionsComponent.scala b/src/main/scala/com/stratio/common/utils/components/transaction_manager/impl/ZookeeperRepositoryWithTransactionsComponent.scala index c2ee6b0..13fa6f8 100644 --- a/src/main/scala/com/stratio/common/utils/components/transaction_manager/impl/ZookeeperRepositoryWithTransactionsComponent.scala +++ b/src/main/scala/com/stratio/common/utils/components/transaction_manager/impl/ZookeeperRepositoryWithTransactionsComponent.scala @@ -27,6 +27,8 @@ trait ZookeeperRepositoryWithTransactionsComponent extends ZookeeperRepositoryCo self: ConfigComponent with LoggerComponent => + override val repository: ZookeeperRepositoryWithTransactions = new ZookeeperRepositoryWithTransactions(None) + class ZookeeperRepositoryWithTransactions(path: Option[String] = None) extends ZookeeperRepository(path) with TransactionalRepository { @@ -70,7 +72,7 @@ trait ZookeeperRepositoryWithTransactionsComponent extends ZookeeperRepositoryCo } private def lockPath(entity: String)(resource: TransactionResource): String = { - s"$entity/locks" + s"$entity/locks/${resource.id}" } override def atomically[T](