com.gemstone.gemfire.cache.RegionMembershipListener Maven / Gradle / Ivy
Show all versions of gemfire-core Show documentation
/*
* Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you
* may not use this file except in compliance with the License. You
* may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License. See accompanying
* LICENSE file.
*/
package com.gemstone.gemfire.cache;
import com.gemstone.gemfire.distributed.DistributedMember;
/**
* A listener that can be implemented to handle region membership events.
*
*
* Instead of implementing this interface it is recommended that you extend
* the {@link com.gemstone.gemfire.cache.util.RegionMembershipListenerAdapter} class.
*
* @author Darrel Schneider
*
*
* @see AttributesFactory#addCacheListener
* @see AttributesFactory#initCacheListeners
* @see RegionAttributes#getCacheListeners
* @see AttributesMutator#addCacheListener
* @see AttributesMutator#removeCacheListener
* @see AttributesMutator#initCacheListeners
* @since 5.0
*/
public interface RegionMembershipListener extends CacheListener {
/**
* Invoked when the listener is first initialized and is
* given the set of members that have the region created at that time.
* The listener is initialized when:
*
* - the region is created with an already added listener
*
- a listener is added using the {@link AttributesMutator}.
*
* @param region the {@link Region} the listener is registered on
* @param initialMembers an array of the other members that have this region
* at the time this listener is added.
*/
public void initialMembers(Region region, DistributedMember[] initialMembers);
/**
* Invoked when another member has created the distributed region this
* listener is on.
* @param event the event from the member whose region was created.
*/
public void afterRemoteRegionCreate(RegionEvent event);
/**
* Invoked when another member's distributed region is no longer
* available to this cache due to normal operations.
* This can be triggered by one of the following methods:
*
* - {@link Region#localDestroyRegion()}
*
- {@link Region#close}
*
- {@link Cache#close()}
*
* This differs from afterRemoteRegionCrash notification in that the
* departed member performed an action either to remove its region or to close
* its region or cache.
* @param event the event from the member whose region is no longer available.
*/
public void afterRemoteRegionDeparture(RegionEvent event);
/**
* Invoked when another member's distributed region is no longer
* available to this cache because the member has crashed or is no
* longer reachable on the network.
* @param event the event from the member whose region is no longer available.
*/
public void afterRemoteRegionCrash(RegionEvent event);
}