Java 类com.hazelcast.core.LifecycleListener 实例源码

项目:health-and-care-developer-network    文件:Node.java   
private void initializeListeners(Config config) {
    for (final ListenerConfig listenerCfg : config.getListenerConfigs()) {
        Object listener = listenerCfg.getImplementation();
        if (listener == null) {
            try {
                listener = Serializer.newInstance(Serializer.loadClass(listenerCfg.getClassName()));
            } catch (Exception e) {
                logger.log(Level.SEVERE, e.getMessage(), e);
            }
        }
        if (listener instanceof InstanceListener) {
            factory.addInstanceListener((InstanceListener) listener);
        } else if (listener instanceof MembershipListener) {
            clusterImpl.addMembershipListener((MembershipListener) listener);
        } else if (listener instanceof MigrationListener) {
            concurrentMapManager.partitionServiceImpl.addMigrationListener((MigrationListener) listener);
        } else if (listener instanceof LifecycleListener) {
            factory.lifecycleService.addLifecycleListener((LifecycleListener) listener);
        } else if (listener != null) {
            final String error = "Unknown listener type: " + listener.getClass();
            Throwable t = new IllegalArgumentException(error);
            logger.log(Level.WARNING, error, t);
        }
    }
}
项目:health-and-care-developer-network    文件:LifecycleServiceClientImpl.java   
public LifecycleServiceClientImpl(HazelcastClient hazelcastClient) {
    this.hazelcastClient = hazelcastClient;

    if (hazelcastClient.getClientConfig() != null) {
        final List<LifecycleListener> listeners = new LinkedList<LifecycleListener>();
        for (Object listener : hazelcastClient.getClientConfig().getListeners()) {
            if (listener instanceof LifecycleListener) {
                listeners.add((LifecycleListener) listener);
            }
        }
        lsLifecycleListeners.addAll(listeners);
    }
}
项目:reactive-data    文件:HazelcastInstanceProxy.java   
/**
 * Adds a life cycle listener
 * @param listener
 */
public void addLifeCycleListener(LifecycleListener listener)
{
    hazelcast.getLifecycleService().addLifecycleListener(listener);
}
项目:hazelcast-archive    文件:LifecycleServiceImpl.java   
public void addLifecycleListener(LifecycleListener lifecycleListener) {
    lsLifecycleListeners.add(lifecycleListener);
}
项目:hazelcast-archive    文件:LifecycleServiceImpl.java   
public void removeLifecycleListener(LifecycleListener lifecycleListener) {
    lsLifecycleListeners.remove(lifecycleListener);
}
项目:hazelcast-archive    文件:LifecycleServiceImpl.java   
public void fireLifecycleEvent(LifecycleEvent lifecycleEvent) {
    logger.log(Level.INFO, node.getThisAddress() + " is " + lifecycleEvent.getState());
    for (LifecycleListener lifecycleListener : lsLifecycleListeners) {
        lifecycleListener.stateChanged(lifecycleEvent);
    }
}
项目:hazelcast-archive    文件:LifecycleServiceClientImpl.java   
public void addLifecycleListener(LifecycleListener lifecycleListener) {
    lsLifecycleListeners.add(lifecycleListener);
}
项目:hazelcast-archive    文件:LifecycleServiceClientImpl.java   
public void removeLifecycleListener(LifecycleListener lifecycleListener) {
    lsLifecycleListeners.remove(lifecycleListener);
}
项目:hazelcast-archive    文件:LifecycleServiceClientImpl.java   
public void fireLifecycleEvent(final LifecycleEvent event) {
    logger.log(Level.INFO, "HazelcastClient is " + event.getState());
    for (LifecycleListener lifecycleListener : lsLifecycleListeners) {
        lifecycleListener.stateChanged(event);
    }
}
项目:health-and-care-developer-network    文件:LifecycleServiceImpl.java   
public void addLifecycleListener(LifecycleListener lifecycleListener) {
    lsLifecycleListeners.add(lifecycleListener);
}
项目:health-and-care-developer-network    文件:LifecycleServiceImpl.java   
public void removeLifecycleListener(LifecycleListener lifecycleListener) {
    lsLifecycleListeners.remove(lifecycleListener);
}
项目:health-and-care-developer-network    文件:LifecycleServiceImpl.java   
public void fireLifecycleEvent(LifecycleEvent lifecycleEvent) {
    getLogger().log(Level.INFO, factory.node.getThisAddress() + " is " + lifecycleEvent.getState());
    for (LifecycleListener lifecycleListener : lsLifecycleListeners) {
        lifecycleListener.stateChanged(lifecycleEvent);
    }
}
项目:health-and-care-developer-network    文件:LifecycleServiceClientImpl.java   
public void addLifecycleListener(LifecycleListener lifecycleListener) {
    lsLifecycleListeners.add(lifecycleListener);
}
项目:health-and-care-developer-network    文件:LifecycleServiceClientImpl.java   
public void removeLifecycleListener(LifecycleListener lifecycleListener) {
    lsLifecycleListeners.remove(lifecycleListener);
}
项目:health-and-care-developer-network    文件:LifecycleServiceClientImpl.java   
public void fireLifecycleEvent(final LifecycleEvent event) {
    logger.log(Level.INFO, "HazelcastClient is " + event.getState());
    for (LifecycleListener lifecycleListener : lsLifecycleListeners) {
        lifecycleListener.stateChanged(event);
    }
}