All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.gemstone.gemfire.cache.InterestRegistrationListener Maven / Gradle / Ivy

The newest version!
/*
 * 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;

/**
 * Interface InterestRegisterationListener provides the ability for
 * applications to be notified of interest registration and unregistration
 * events. Instances must be implemented by applications and registered in
 * CacheServer VMs using the
 * {@link com.gemstone.gemfire.cache.server.CacheServer#registerInterestRegistrationListener
 * registerInterestRegistrationListener} API. The methods on an
 * InterestRegisterationListener are invoked synchronously with the
 * interest event in any CacheServer VM hosting the requesting
 * client's subscriptions.
 *
 * 

Shown below is an example implementation. * *

 *import com.gemstone.gemfire.cache.InterestRegistrationEvent;
 *import com.gemstone.gemfire.cache.InterestRegistrationListener;
 *
 *public class TestInterestRegistrationListener implements InterestRegistrationListener {
 *
 *  public void afterRegisterInterest(InterestRegistrationEvent event) {
 *    System.out.println("afterRegisterInterest: " + event.getRegionName() + " -> " + event.getKeysOfInterest());
 *  }

 *  public void afterUnregisterInterest(InterestRegistrationEvent event) {
 *    System.out.println("afterUnregisterInterest: " + event.getRegionName() + " -> " + event.getKeysOfInterest());
 *  }
 *
 *  public void close() {}
 *}
 * 
* * Shown below is an example registration. * *
 *private void registerInterestRegistrationListener() {
 *  Cache cache = ...;
 *  CacheServer cs = cache.getCacheServers().iterator().next();
 *  InterestRegistrationListener listener = new TestInterestRegistrationListener();
 *  cs.registerInterestRegistrationListener(listener);
 *}
 * 
* * @author Barry Oglesby * * @since 6.0 * * @see com.gemstone.gemfire.cache.server.CacheServer#registerInterestRegistrationListener registerInterestRegistrationListener * @see com.gemstone.gemfire.cache.server.CacheServer#unregisterInterestRegistrationListener unregisterInterestRegistrationListener */ public interface InterestRegistrationListener extends CacheCallback { /** * Handles an after register interest event. * * @param event the InterestRegistrationEvent */ public void afterRegisterInterest(InterestRegistrationEvent event); /** * Handles an after unregister interest event. * * @param event the InterestRegistrationEvent */ public void afterUnregisterInterest(InterestRegistrationEvent event); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy