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:
-
DistributedMember
DistributedSystem
ConfigurableApplicationContext
MemberDepartedEvent
MemberJoinedEvent
-
Constructor Summary
ConstructorDescriptionApplicationContextMembershipListener
(org.springframework.context.ConfigurableApplicationContext applicationContext) Constructs a new instance ofConfigurableApplicationContext
initialized with the givenConfigurableApplicationContext
. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.springframework.context.ConfigurableApplicationContext
Returns a reference to the configuredConfigurableApplicationContext
.void
Handles themembership event
when apeer member
departs from thecluster
by callingConfigurableApplicationContext.close()
.void
Handles themembership event
when apeer member
joins thecluster
by 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 ofConfigurableApplicationContext
initialized with the givenConfigurableApplicationContext
.- Parameters:
applicationContext
- configuredConfigurableApplicationContext
; must not be null.- Throws:
IllegalArgumentException
- ifConfigurableApplicationContext
is 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 event
when apeer member
departs from thecluster
by callingConfigurableApplicationContext.close()
.- Overrides:
handleMemberDeparted
in classMembershipListenerAdapter<ApplicationContextMembershipListener>
- Parameters:
event
-MemberDepartedEvent
to handle.- See Also:
-
MemberDepartedEvent
ConfigurableApplicationContext.close()
-
handleMemberJoined
Handles themembership event
when apeer member
joins thecluster
by callingConfigurableApplicationContext.refresh()
.- Overrides:
handleMemberJoined
in classMembershipListenerAdapter<ApplicationContextMembershipListener>
- Parameters:
event
-MemberJoinedEvent
to handle.- See Also:
-
MemberJoinedEvent
ConfigurableApplicationContext.refresh()
-