Class PushNotificationEngineProvider
java.lang.Object
com.iizix.push.PushNotificationEngineProvider
The seam through which the push engine implementation reaches
com.iizix.core.The engine lives in the com.iizix.server.push bundle, which requires com.iizix.server, which requires com.iizix.core, where IPushNotificationService lives. Core can therefore not name the engine class and IServer.getPushNotificationEngine() cannot construct it. Instead the engine bundle registers its engine here when its server module is initialized, and unregisters it when the module is disposed; the default accessor on IPushNotificationService reads it back. No server class needs to know the engine's name.
At most one engine is registered at a time: registering a second, live engine is an error, because two engines would each own a spool file, a subscription table and the HTTP endpoints. A disposed engine may be replaced.
- Author:
- Christopher Mindus
Method Summary
Modifier and TypeMethodDescriptionstatic IPushNotificationEngineGets the registered engine.static voidregister(IPushNotificationEngine newEngine) Registers the engine of this server.static booleanunregister(IPushNotificationEngine oldEngine) Unregisters an engine.
Method Details
register
Registers the engine of this server.- Parameters:
newEngine- The engine.- Throws:
NullPointerException- IfnewEngineisnull.IllegalStateException- If another engine is registered and not disposed.
unregister
Unregisters an engine. Does nothing when another engine is registered.- Parameters:
oldEngine- The engine that was registered.- Returns:
- true if it was the registered engine and is now unregistered, false otherwise.
getEngine
Gets the registered engine.- Returns:
- The engine, or
nullwhen none is registered.