Skip to content

Commit

Permalink
Extending local repository for providing new feature to hazelcast net…
Browse files Browse the repository at this point in the history
…work repository
  • Loading branch information
ngaud committed Oct 22, 2020
1 parent ac1acba commit eb08545
Showing 1 changed file with 23 additions and 1 deletion.
Expand Up @@ -21,13 +21,14 @@
package io.sarl.sre.services.context

import com.google.inject.Injector
import io.sarl.lang.core.Space
import io.sarl.sre.boot.configs.SreConfig
import io.sarl.sre.internal.SmartListenerCollection
import io.sarl.sre.services.executor.ExecutorService
import io.sarl.sre.spaces.SreSpaceSpecificationFactory
import java.util.UUID
import java.util.concurrent.ConcurrentHashMap
import javax.inject.Inject
import io.sarl.sre.spaces.SreSpaceSpecificationFactory

/**
* A repository of spaces specific to a given context.
Expand Down Expand Up @@ -89,4 +90,25 @@ class LocalSpaceRepository extends SpaceRepository {
this.spaces
}

def existsSpace(spaceUUID : UUID) : boolean {
this.spaces.contains(spaceUUID)
}

def removeSpaceIfEmpty(spaceUUID : UUID) {
var spaceToRemove: Space = this.spaces.get(spaceUUID).^space
if (spaceToRemove.isPseudoEmpty) {
super.removeSpace(spaceToRemove)
}
}

def removeAllSpacesIfEmpty() {
var spaceToRemove: Space
for (spaceDesc : this.spaces.values) {
spaceToRemove = spaceDesc.^space
if (spaceToRemove.isPseudoEmpty) {
super.removeSpace(spaceToRemove)
}
}
}

}

0 comments on commit eb08545

Please sign in to comment.