Spring Boot for VMware GemFire
Class ApplicationContextMembershipListener
java.lang.Object
org.springframework.geode.distributed.event.MembershipListenerAdapter<ApplicationContextMembershipListener>
org.springframework.geode.distributed.event.ApplicationContextMembershipListener
- All Implemented Interfaces:
EventListener,org.apache.geode.distributed.internal.MembershipListener
public class ApplicationContextMembershipListener
extends MembershipListenerAdapter<ApplicationContextMembershipListener>
The
ApplicationContextMembershipListener class is an extension of MembershipListenerAdapter used to
adapt the ConfigurableApplicationContext to handle and process membership events,
and specifically MemberDepartedEvent and MemberJoinedEvent, by
closing and refreshing
the ConfigurableApplicationContext when the peer member departs and joins the
cluster.- Since:
- 1.3.0
- See Also:
-
DistributedMemberDistributedSystemConfigurableApplicationContextMemberDepartedEventMemberJoinedEvent
-
Constructor Summary
ConstructorsConstructorDescriptionApplicationContextMembershipListener(org.springframework.context.ConfigurableApplicationContext applicationContext) Constructs a new instance ofConfigurableApplicationContextinitialized with the givenConfigurableApplicationContext. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.springframework.context.ConfigurableApplicationContextReturns a reference to the configuredConfigurableApplicationContext.voidHandles themembership eventwhen apeer memberdeparts from theclusterby callingConfigurableApplicationContext.close().voidHandles themembership eventwhen apeer memberjoins theclusterby callingConfigurableApplicationContext.refresh().Methods inherited from class org.springframework.geode.distributed.event.MembershipListenerAdapter
handleMemberSuspect, handleQuorumLost, memberDeparted, memberJoined, memberSuspect, quorumLost, register
-
Constructor Details
-
ApplicationContextMembershipListener
public ApplicationContextMembershipListener(@NonNull org.springframework.context.ConfigurableApplicationContext applicationContext) Constructs a new instance ofConfigurableApplicationContextinitialized with the givenConfigurableApplicationContext.- Parameters:
applicationContext- configuredConfigurableApplicationContext; must not be null.- Throws:
IllegalArgumentException- ifConfigurableApplicationContextis null.- See Also:
-
ConfigurableApplicationContext
-
-
Method Details
-
getApplicationContext
@NonNull protected org.springframework.context.ConfigurableApplicationContext getApplicationContext()Returns a reference to the configuredConfigurableApplicationContext.- Returns:
- a reference to the configured
ConfigurableApplicationContext. - See Also:
-
ConfigurableApplicationContext
-
handleMemberDeparted
Handles themembership eventwhen apeer memberdeparts from theclusterby callingConfigurableApplicationContext.close().- Overrides:
handleMemberDepartedin classMembershipListenerAdapter<ApplicationContextMembershipListener>- Parameters:
event-MemberDepartedEventto handle.- See Also:
-
MemberDepartedEventConfigurableApplicationContext.close()
-
handleMemberJoined
Handles themembership eventwhen apeer memberjoins theclusterby callingConfigurableApplicationContext.refresh().- Overrides:
handleMemberJoinedin classMembershipListenerAdapter<ApplicationContextMembershipListener>- Parameters:
event-MemberJoinedEventto handle.- See Also:
-
MemberJoinedEventConfigurableApplicationContext.refresh()
-