public class ModeAnnotationRegistry extends Object implements SpaceBeforePrimaryListener, SpaceAfterPrimaryListener, SpaceBeforeBackupListener, SpaceAfterBackupListener
PreBackup,
PostBackup, PrePrimary, PostPrimary are registered in this bean, and when
events arrive they are routed to the registered beans' methods.| Modifier and Type | Field and Description |
|---|---|
protected Hashtable<Class<?>,HashSet<org.openspaces.core.space.mode.registry.ModeAnnotationRegistry.RegistryEntry>> |
registry
Maps the annotation to the list of beans' methods to invoke.
|
| Constructor and Description |
|---|
ModeAnnotationRegistry() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
fireEvent(HashSet<org.openspaces.core.space.mode.registry.ModeAnnotationRegistry.RegistryEntry> entries,
Object event)
Invokes the registered beans' methods passing them the space mode change event.
|
void |
onAfterBackup(AfterSpaceModeChangeEvent event)
Invoked after a space changes its mode to
SpaceMode.BACKUP. |
void |
onAfterPrimary(AfterSpaceModeChangeEvent event)
Invoked after a space changes its mode to
SpaceMode.PRIMARY. |
void |
onBeforeBackup(BeforeSpaceModeChangeEvent event)
Invoked before a space changes its mode to
SpaceMode.BACKUP. |
void |
onBeforePrimary(BeforeSpaceModeChangeEvent event)
Invoked before a space changes its mode to
SpaceMode.PRIMARY. |
void |
registerAnnotation(Class<?> annotation,
Object object,
Method method)
Registers the bean as a listener for a space mode event specified by the annotation.
|
public void registerAnnotation(Class<?> annotation, Object object, Method method) throws IllegalArgumentException
PreBackup or PrePrimary the target invocation method may
have no parameters or a single parameter of type BeforeSpaceModeChangeEvent. If the
annotation is PostBackup or PostPrimary the target invocation method may have
no parameters or a single parameter of type AfterSpaceModeChangeEvent.annotation - The space mode annotation that specifies the event the bean is registered
to.object - The bean instance.method - The bean's method to invoke when the event fires.IllegalArgumentException - When the specified method has more than one parameter, or
when the method's parameter is not of the types BeforeSpaceModeChangeEvent or AfterSpaceModeChangeEvent,
or when the specified bean is not the one declaring the
specified method.public void onBeforePrimary(BeforeSpaceModeChangeEvent event)
SpaceMode.PRIMARY.onBeforePrimary in interface SpaceBeforePrimaryListenerpublic void onAfterPrimary(AfterSpaceModeChangeEvent event)
SpaceMode.PRIMARY.onAfterPrimary in interface SpaceAfterPrimaryListenerpublic void onBeforeBackup(BeforeSpaceModeChangeEvent event)
SpaceMode.BACKUP.onBeforeBackup in interface SpaceBeforeBackupListenerpublic void onAfterBackup(AfterSpaceModeChangeEvent event)
SpaceMode.BACKUP.onAfterBackup in interface SpaceAfterBackupListenerprotected void fireEvent(HashSet<org.openspaces.core.space.mode.registry.ModeAnnotationRegistry.RegistryEntry> entries, Object event)
entries - A list of beans and methods to invoke.event - The event to pass to the methods in case they expect a parameter.Copyright © GigaSpaces.