当前位置: 首页>>代码示例>>Java>>正文


Java CuratorListener类代码示例

本文整理汇总了Java中org.apache.curator.framework.api.CuratorListener的典型用法代码示例。如果您正苦于以下问题:Java CuratorListener类的具体用法?Java CuratorListener怎么用?Java CuratorListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CuratorListener类属于org.apache.curator.framework.api包,在下文中一共展示了CuratorListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addListener

import org.apache.curator.framework.api.CuratorListener; //导入依赖的package包/类
@Override
public void addListener(Object listener) {
    CuratorListener curatorListener = (CuratorListener) listener;
    if (curator != null) {
        curator.getCuratorListenable().addListener(curatorListener);
    }
    listeners.add(curatorListener);
}
 
开发者ID:Comcast,项目名称:redirector,代码行数:9,代码来源:ListenerProxy.java

示例2: removeListener

import org.apache.curator.framework.api.CuratorListener; //导入依赖的package包/类
@Override
public void removeListener(Object listener) {
    CuratorListener curatorListener = (CuratorListener) listener;
    if (curator != null) {
        curator.getCuratorListenable().removeListener(curatorListener);
    }
    listeners.remove(curatorListener);
}
 
开发者ID:Comcast,项目名称:redirector,代码行数:9,代码来源:ListenerProxy.java

示例3: clearCurator

import org.apache.curator.framework.api.CuratorListener; //导入依赖的package包/类
public void clearCurator() {
    for (CuratorListener curatorListener : listeners) {
        if (curator != null) {
            curator.getCuratorListenable().removeListener(curatorListener);
        }
    }
}
 
开发者ID:Comcast,项目名称:redirector,代码行数:8,代码来源:ListenerProxy.java

示例4: updateCurator

import org.apache.curator.framework.api.CuratorListener; //导入依赖的package包/类
public void updateCurator(CuratorFramework curator) {
    this.curator = curator;
    for (CuratorListener curatorListener : listeners) {
        if (this.curator != null) {
            this.curator.getCuratorListenable().addListener(curatorListener);
        }
    }
}
 
开发者ID:Comcast,项目名称:redirector,代码行数:9,代码来源:ListenerProxy.java

示例5: mkClient

import org.apache.curator.framework.api.CuratorListener; //导入依赖的package包/类
/**
 * connect ZK, register Watch/unhandle Watch
 * 
 * @return
 */
public CuratorFramework mkClient(Map conf, List<String> servers,
		Object port, String root, final WatcherCallBack watcher) {

	CuratorFramework fk = Utils.newCurator(conf, servers, port, root);

	fk.getCuratorListenable().addListener(new CuratorListener() {
		@Override
		public void eventReceived(CuratorFramework _fk, CuratorEvent e)
				throws Exception {
			if (e.getType().equals(CuratorEventType.WATCHED)) {
				WatchedEvent event = e.getWatchedEvent();

				watcher.execute(event.getState(), event.getType(),
						event.getPath());
			}

		}
	});

	fk.getUnhandledErrorListenable().addListener(
			new UnhandledErrorListener() {
				@Override
				public void unhandledError(String msg, Throwable error) {
					String errmsg = "Unrecoverable Zookeeper error, halting process: "
							+ msg;
					LOG.error(errmsg, error);
					JStormUtils.halt_process(1,
							"Unrecoverable Zookeeper error");

				}
			});
	fk.start();
	return fk;
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:40,代码来源:Zookeeper.java

示例6: mkClient

import org.apache.curator.framework.api.CuratorListener; //导入依赖的package包/类
/**
 * connect ZK, register Watch/unhandle Watch
 * 
 * @return
 */
public CuratorFramework mkClient(Map conf, List<String> servers, Object port, String root, final WatcherCallBack watcher) {

    CuratorFramework fk = Utils.newCurator(conf, servers, port, root);

    fk.getCuratorListenable().addListener(new CuratorListener() {
        @Override
        public void eventReceived(CuratorFramework _fk, CuratorEvent e) throws Exception {
            if (e.getType().equals(CuratorEventType.WATCHED)) {
                WatchedEvent event = e.getWatchedEvent();

                watcher.execute(event.getState(), event.getType(), event.getPath());
            }

        }
    });

    fk.getUnhandledErrorListenable().addListener(new UnhandledErrorListener() {
        @Override
        public void unhandledError(String msg, Throwable error) {
            String errmsg = "Unrecoverable Zookeeper error, halting process: " + msg;
            LOG.error(errmsg, error);
            JStormUtils.halt_process(1, "Unrecoverable Zookeeper error");

        }
    });
    fk.start();
    return fk;
}
 
开发者ID:kkllwww007,项目名称:jstrom,代码行数:34,代码来源:Zookeeper.java

示例7: DefaultCuratorManagementService

import org.apache.curator.framework.api.CuratorListener; //导入依赖的package包/类
@Inject
DefaultCuratorManagementService(@Curator final CuratorFramework framework,
        final Set<ConnectionStateListener> connectionStateListeners, final Set<CuratorListener> curatorListeners,
        final Set<UnhandledErrorListener> unhandledErrorListeners) {
    this.framework = framework;
    this.connectionStateListeners = connectionStateListeners;
    this.curatorListeners = curatorListeners;
    this.unhandledErrorListeners = unhandledErrorListeners;
}
 
开发者ID:dclements,项目名称:cultivar_old,代码行数:10,代码来源:DefaultCuratorManagementService.java

示例8: DefaultCuratorManagementService

import org.apache.curator.framework.api.CuratorListener; //导入依赖的package包/类
@Inject
DefaultCuratorManagementService(@Curator final CuratorFramework framework,
        final Set<ConnectionStateListener> connectionStateListeners, final Set<CuratorListener> curatorListeners,
        final Set<UnhandledErrorListener> unhandledErrorListeners) {
    this(framework, connectionStateListeners, curatorListeners, unhandledErrorListeners, LoggerFactory
            .getLogger(DefaultCuratorManagementService.class));
}
 
开发者ID:ReadyTalk,项目名称:cultivar,代码行数:8,代码来源:DefaultCuratorManagementService.java

示例9: mkClient

import org.apache.curator.framework.api.CuratorListener; //导入依赖的package包/类
/**
 * connect ZK, register watchers
 */
public CuratorFramework mkClient(Map conf, List<String> servers, Object port,
                                 String root, final WatcherCallBack watcher) {

    CuratorFramework fk = Utils.newCurator(conf, servers, port, root);

    fk.getCuratorListenable().addListener(new CuratorListener() {
        @Override
        public void eventReceived(CuratorFramework _fk, CuratorEvent e) throws Exception {
            if (e.getType().equals(CuratorEventType.WATCHED)) {
                WatchedEvent event = e.getWatchedEvent();

                watcher.execute(event.getState(), event.getType(), event.getPath());
            }

        }
    });

    fk.getUnhandledErrorListenable().addListener(new UnhandledErrorListener() {
        @Override
        public void unhandledError(String msg, Throwable error) {
            String errmsg = "Unrecoverable zookeeper error, halting process: " + msg;
            LOG.error(errmsg, error);
            JStormUtils.halt_process(1, "Unrecoverable zookeeper error");

        }
    });
    fk.start();
    return fk;
}
 
开发者ID:alibaba,项目名称:jstorm,代码行数:33,代码来源:Zookeeper.java

示例10: getCuratorListenable

import org.apache.curator.framework.api.CuratorListener; //导入依赖的package包/类
@Override
public Listenable<CuratorListener> getCuratorListenable() {
    throw new UnsupportedOperationException("Not implemented in MockCurator");
}
 
开发者ID:vespa-engine,项目名称:vespa,代码行数:5,代码来源:MockCurator.java

示例11: configure

import org.apache.curator.framework.api.CuratorListener; //导入依赖的package包/类
@Override
protected void configure() {
    install(new CuratorInnerModule(dependencies));
    install(new BarrierModule());
    install(new LastKnownStateModule());

    Multibinder.newSetBinder(binder(), CuratorService.class);

    Multibinder.newSetBinder(binder(), UnhandledErrorListener.class);

    Multibinder.newSetBinder(binder(), CuratorListener.class);

    Multibinder<ConnectionStateListener> connectionStateListeners = Multibinder.newSetBinder(binder(),
            ConnectionStateListener.class);

    connectionStateListeners.addBinding().to(ConnectionStateLogger.class).in(Singleton.class);

    bind(CultivarStartStopManager.class).to(DefaultCultivarStartStopManager.class).in(Singleton.class);
}
 
开发者ID:dclements,项目名称:cultivar_old,代码行数:20,代码来源:CuratorModule.java

示例12: addCuratorListener

import org.apache.curator.framework.api.CuratorListener; //导入依赖的package包/类
@Override
public void addCuratorListener(final CuratorListener listener) {
    framework.getCuratorListenable().addListener(listener);

}
 
开发者ID:dclements,项目名称:cultivar_old,代码行数:6,代码来源:DefaultCuratorManagementService.java

示例13: getCuratorListenable

import org.apache.curator.framework.api.CuratorListener; //导入依赖的package包/类
@Override
public Listenable<CuratorListener> getCuratorListenable()
{
    throw new UnsupportedOperationException("getCuratorListenable() is only available from a non-namespaced CuratorFramework instance");
}
 
开发者ID:apache,项目名称:curator,代码行数:6,代码来源:NamespaceFacade.java

示例14: getCuratorListenable

import org.apache.curator.framework.api.CuratorListener; //导入依赖的package包/类
@Override
public Listenable<CuratorListener> getCuratorListenable()
{
    return client.getCuratorListenable();
}
 
开发者ID:apache,项目名称:curator,代码行数:6,代码来源:WatcherRemovalFacade.java

示例15: configure

import org.apache.curator.framework.api.CuratorListener; //导入依赖的package包/类
@Override
protected void configure() {
    install(new CuratorInnerModule(dependencies));
    install(new BarrierModule());
    install(new LastKnownStateModule());

    bind(BlankCuratorService.class).annotatedWith(Private.class).to(BlankCuratorService.class).in(Scopes.SINGLETON);

    Multibinder.newSetBinder(binder(), CuratorService.class).addBinding()
            .to(Key.get(BlankCuratorService.class, Private.class));

    Multibinder.newSetBinder(binder(), UnhandledErrorListener.class);

    Multibinder.newSetBinder(binder(), CuratorListener.class);

    Multibinder.newSetBinder(binder(), ServiceManager.class, Cultivar.class);

    Multibinder<ConnectionStateListener> connectionStateListeners = Multibinder.newSetBinder(binder(),
            ConnectionStateListener.class);

    connectionStateListeners.addBinding().to(ConnectionStateLogger.class).in(Singleton.class);

    bind(CultivarStartStopManager.class).to(DefaultCultivarStartStopManager.class).in(Singleton.class);
}
 
开发者ID:ReadyTalk,项目名称:cultivar,代码行数:25,代码来源:CuratorModule.java


注:本文中的org.apache.curator.framework.api.CuratorListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。