diff options
author | Zach Smith <zach@driver.xyz> | 2017-09-27 22:20:53 -0700 |
---|---|---|
committer | Zach Smith <zach@driver.xyz> | 2017-10-12 16:48:08 -0700 |
commit | 2c524be93052fc6d57359a00fd60d957099885c6 (patch) | |
tree | b68467ca2fd4f4f101da1ce315c022ab12220145 /src/main/scala/xyz/driver/core/rest/SavingUsedServiceDiscovery.scala | |
parent | b00892d723f6dedf50dc1c1fde7d443e9c3f9497 (diff) | |
download | driver-core-2c524be93052fc6d57359a00fd60d957099885c6.tar.gz driver-core-2c524be93052fc6d57359a00fd60d957099885c6.tar.bz2 driver-core-2c524be93052fc6d57359a00fd60d957099885c6.zip |
Refactor rest package into separate files
Diffstat (limited to 'src/main/scala/xyz/driver/core/rest/SavingUsedServiceDiscovery.scala')
-rw-r--r-- | src/main/scala/xyz/driver/core/rest/SavingUsedServiceDiscovery.scala | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main/scala/xyz/driver/core/rest/SavingUsedServiceDiscovery.scala b/src/main/scala/xyz/driver/core/rest/SavingUsedServiceDiscovery.scala new file mode 100644 index 0000000..8018bdf --- /dev/null +++ b/src/main/scala/xyz/driver/core/rest/SavingUsedServiceDiscovery.scala @@ -0,0 +1,14 @@ +package xyz.driver.core.rest + +import xyz.driver.core.Name + +trait SavingUsedServiceDiscovery { + + private val usedServices = new scala.collection.mutable.HashSet[String]() + + def saveServiceUsage(serviceName: Name[Service]): Unit = usedServices.synchronized { + usedServices += serviceName.value + } + + def getUsedServices: Set[String] = usedServices.synchronized { usedServices.toSet } +} |