
com.alachisoft.ncache.client.internal.caching.NotificationServiceImpl Maven / Gradle / Ivy
package com.alachisoft.ncache.client.internal.caching;
import com.alachisoft.ncache.client.*;
import com.alachisoft.ncache.client.services.NotificationService;
import com.alachisoft.ncache.runtime.exceptions.CacheException;
import java.util.EnumSet;
class NotificationServiceImpl implements NotificationService {
CacheImpl _cache;
NotificationServiceImpl(CacheImpl cache) {
_cache = cache;
}
void setCache(CacheImpl cacheImpl) {
_cache = cacheImpl;
}
@Override
public void addCacheConnectivityChangedListener(CacheClientConnectivityChangedListener listener) throws CacheException {
_cache.addClientConnectivityChangedListener(listener);
}
@Override
public void removeCacheConnectivityChangedListener(CacheClientConnectivityChangedListener listener) throws CacheException {
_cache.removeClientConnectivityChangedListener(listener);
}
@Override
public void addCacheClearedListener(CacheClearedListener listener) throws CacheException {
_cache.addCacheClearedListner(listener);
}
@Override
public void removeCacheClearedListener(CacheClearedListener listener) throws CacheException {
_cache.removeCacheClearedListner(listener);
}
@Override
public void addCacheStatusEventListener(CacheStatusEventListener cacheStatusEventListener, EnumSet types)throws CacheException,IllegalArgumentException
{
if(types.contains(CacheStatusNotificationType.CacheStopped))
_cache.addCacheStoppedListener(cacheStatusEventListener);
if(types.contains(CacheStatusNotificationType.MemberJoined))
_cache.addMemberJoinedListener(cacheStatusEventListener);
if(types.contains(CacheStatusNotificationType.MemberLeft))
_cache.addMemberLeftListener(cacheStatusEventListener);
}
@Override
public void removeCacheStatusEventListener(CacheStatusEventListener cacheStatusEventListener, EnumSet types)throws CacheException,IllegalArgumentException
{
if(types.contains(CacheStatusNotificationType.CacheStopped))
_cache.removeCacheStoppedListener(cacheStatusEventListener);
if(types.contains(CacheStatusNotificationType.MemberJoined))
_cache.removeMemberJoinedListener(cacheStatusEventListener);
if(types.contains(CacheStatusNotificationType.MemberLeft))
_cache.removeMemberLeftListener(cacheStatusEventListener);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy