Class StorerModeController

java.lang.Object
one.microstream.persistence.types.StorerModeController
All Implemented Interfaces:
PersistenceStorerDeactivatableRegistry

public class StorerModeController
extends Object
implements PersistenceStorerDeactivatableRegistry
The StorerModeController provides API to control the write mode of registered PersistenceStorer implementations from a central instance.
Storers are register with register(PersistenceStorerDeactivatable). They will be registers using WeakReferences. That will be checked and cleaned up periodically.

As this class starts an internal thread use the shutdown() call to speed up termination. Otherwise the internal thread will run until all registered stores are disposed by the JVMs garbage collector.
Usage:

final StorerModeController storerModeController = new StorerModeController();
final EmbeddedStorageManager storage = EmbeddedStorage
	.Foundation()
	.onConnectionFoundation(connectionFoundation ->
		connectionFoundation.setStorerCreator(
			PersistenceStorerCreatorDeactivatable.New(
				connectionFoundation,
				storerModeController)))
	.start();

storerModeController.disableWriting();

assertThrows(PersistenceExceptionStorerDeactivated.class,
	() -> storage.store("Hello World"));