public abstract class AbstractGrid extends java.lang.Object implements Grid
Grid
base implementation.Constructor and Description |
---|
AbstractGrid() |
Modifier and Type | Method and Description |
---|---|
void |
addGridListener(GridListener listener)
Adds a listener to be notified of grid members events.
|
void |
addInterceptor(GridMemberInterceptor interceptor)
Add a channel interceptor to the end of the list.
|
boolean |
addMember(GridMember node)
Adds a new grid member.
|
protected GridMemberInterceptorChain |
getInterceptorChain()
Exposes the interceptor chain for subclasses.
|
java.util.List<GridMemberInterceptor> |
getInterceptors()
Return a read-only list of the configured interceptors.
|
GridMember |
getMember(org.apache.hadoop.yarn.api.records.ContainerId id)
Gets a grid member.
|
java.util.Collection<GridMember> |
getMembers()
Gets collection of grid members know to the grid system or
empty collection if there are no known members.
|
protected void |
notifyMemberAdded(GridMember member)
Notifies registered
ContainerGridListener s that
a ContainerNode has been added to a ContainerGrid . |
protected void |
notifyMemberRemoved(GridMember member)
Notifies registered
ContainerGridListener s that
a ContainerNode has been removed from a ContainerGrid . |
boolean |
removeMember(org.apache.hadoop.yarn.api.records.ContainerId id)
Removes a grid member.
|
void |
setInterceptors(java.util.List<GridMemberInterceptor> interceptors)
Set the list of channel interceptors.
|
public java.util.Collection<GridMember> getMembers()
Grid
getMembers
in interface Grid
public GridMember getMember(org.apache.hadoop.yarn.api.records.ContainerId id)
Grid
public boolean addMember(GridMember node)
Grid
If a grid refuses to add a particular member for any reason other than that it already contains the member, it must throw an exception (rather than returning false). This preserves the invariant that a grid always contains the specified node after this call returns.
public boolean removeMember(org.apache.hadoop.yarn.api.records.ContainerId id)
Grid
Removes a single instance of the specified member from this grid, if it is present.
removeMember
in interface Grid
id
- the container id identifierpublic void addGridListener(GridListener listener)
Grid
addGridListener
in interface Grid
listener
- the grid listenerpublic void setInterceptors(java.util.List<GridMemberInterceptor> interceptors)
interceptors
- list of interceptorspublic void addInterceptor(GridMemberInterceptor interceptor)
addInterceptor
in interface Grid
interceptor
- the interceptorpublic java.util.List<GridMemberInterceptor> getInterceptors()
protected GridMemberInterceptorChain getInterceptorChain()
protected void notifyMemberAdded(GridMember member)
ContainerGridListener
s that
a ContainerNode
has been added to a ContainerGrid
.member
- the nodeprotected void notifyMemberRemoved(GridMember member)
ContainerGridListener
s that
a ContainerNode
has been removed from a ContainerGrid
.member
- the node