|
GigaSpaces XAP 9.7.2 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.openspaces.core.space.mode.registry.ModeAnnotationRegistry
public class ModeAnnotationRegistry
Receives space mode change events and routs them to beans that use annotations to register as listeners on
those events.
When the application starts beans that has one or more of the annotation PreBackup
, PostBackup
,
PrePrimary
, PostPrimary
are registered in this bean, and when events arrive they are routed
to the registered beans' methods.
Field Summary | |
---|---|
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 Summary | |
---|---|
ModeAnnotationRegistry()
|
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Hashtable<Class<?>,HashSet<org.openspaces.core.space.mode.registry.ModeAnnotationRegistry.RegistryEntry>> registry
Constructor Detail |
---|
public ModeAnnotationRegistry()
Method Detail |
---|
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 SpaceBeforePrimaryListener
public void onAfterPrimary(AfterSpaceModeChangeEvent event)
SpaceMode.PRIMARY
.
onAfterPrimary
in interface SpaceAfterPrimaryListener
public void onBeforeBackup(BeforeSpaceModeChangeEvent event)
SpaceMode.BACKUP
.
onBeforeBackup
in interface SpaceBeforeBackupListener
public void onAfterBackup(AfterSpaceModeChangeEvent event)
SpaceMode.BACKUP
.
onAfterBackup
in interface SpaceAfterBackupListener
protected 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.
|
GigaSpaces XAP 9.7.2 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |