The InfinispanSource maps workspaces to named caches within Infinispan, so if you're dynamically creating workspaces, that's equivalent to dynamically creating Infinispan named caches (which Infinispan handles quite well).
Unfortunately, the InfinispanSource in one ModeShape process doesn't properly discover workspaces that are dynamically created in other ModeShape processes in a ModeShape cluster. That's clearly a deficiency for folks using Infinispan, clustering ModeShape, and dynamically creating workspaces. That means that the JCR method Workspace.getAccessibleWorkspaceNames() will return only those workspaces that were a) predefined in the configuration file or b) created on that same clustered process.
The InfinispanSource needs to properly determine the workspace names by looking at the available caches. If this is an CacheContainer is an EmbeddedCacheManager instance, then we can just use the EmbeddedCacheManager.getCacheNames() method. But we'll have to use a different method for RemoteCacheManager instances (see
ISPN-984), or at least have that as a limitation.
Note that even though we might be able to get the cache names, we still have to check each named cache (i.e., workspace) to find out if it has an entry for the root node, and this check needs to be very tolerant for all Throwable issues (e.g., the value is not the correct class, or may be an instance of a class that cannot be loaded by our class loader, etc.).