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


Java EventManager类代码示例

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


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

示例1: createServiceBundle

import io.advantageous.qbit.events.EventManager; //导入依赖的package包/类
default ServiceBundle createServiceBundle(String address,
                                          final QueueBuilder requestQueueBuilder,
                                          final QueueBuilder responseQueueBuilder,
                                          final QueueBuilder webResponseQueueBuilder,
                                          final Factory factory, final boolean asyncCalls,
                                          final BeforeMethodCall beforeMethodCall,
                                          final BeforeMethodCall beforeMethodCallAfterTransform,
                                          final Transformer<Request, Object> argTransformer,
                                          boolean invokeDynamic,
                                          final QBitSystemManager systemManager,
                                          final HealthServiceAsync healthService,
                                          final StatsCollector statsCollector,
                                          final Timer timer,
                                          final int statsFlushRateSeconds,
                                          final int checkTimingEveryXCalls,
                                          final CallbackManager callbackManager,
                                          final EventManager eventManager,
                                          final BeforeMethodSent beforeMethodSent,
                                          final BeforeMethodCall beforeMethodCallOnServiceQueue, AfterMethodCall afterMethodCallOnServiceQueue) {
    throw new UnsupportedOperationException();
}
 
开发者ID:advantageous,项目名称:qbit,代码行数:22,代码来源:Factory.java

示例2: ServiceQueueImpl

import io.advantageous.qbit.events.EventManager; //导入依赖的package包/类
public ServiceQueueImpl(final String rootAddress,
                        final String serviceAddress,
                        final Object service,
                        final QueueBuilder requestQueueBuilder,
                        final QueueBuilder responseQueueBuilder,
                        final ServiceMethodHandler serviceMethodHandler,
                        final Queue<Response<Object>> responseQueue,
                        final boolean async,
                        final boolean handleCallbacks,
                        final QBitSystemManager systemManager,
                        final BeforeMethodCall beforeMethodCall,
                        final BeforeMethodCall beforeMethodCallAfterTransform,
                        final AfterMethodCall afterMethodCall,
                        final AfterMethodCall afterMethodCallAfterTransform,
                        final QueueCallBackHandler handler,
                        final CallbackManager callbackManager,
                        final BeforeMethodSent beforeMethodSent,
                        final EventManager eventManager,
                        final boolean joinEventManager) {
    super(rootAddress, serviceAddress, service, requestQueueBuilder, responseQueueBuilder,
            serviceMethodHandler, responseQueue,
            async, handleCallbacks, systemManager, beforeMethodCall, beforeMethodCallAfterTransform,
            afterMethodCall, afterMethodCallAfterTransform, handler, callbackManager, beforeMethodSent, eventManager,
            joinEventManager);
}
 
开发者ID:advantageous,项目名称:qbit,代码行数:26,代码来源:ServiceQueueImpl.java

示例3: systemEventManager

import io.advantageous.qbit.events.EventManager; //导入依赖的package包/类
@Override
public EventManager systemEventManager() {

    final EventManager eventManager = eventManagerThreadLocal.get();
    if (eventManager != null) {
        return eventManager;
    }

    EventManager proxy;
    if (systemEventManager.get() == null) {
        final ServiceQueue serviceQueue = serviceBuilder().setInvokeDynamic(false)
                .setServiceObject(
                        EventManagerBuilder.eventManagerBuilder().setName("QBIT_SYSTEM").build()).build().startServiceQueue();

        systemEventManager.set(serviceQueue);
        proxy = serviceQueue.createProxyWithAutoFlush(EventManager.class, 100, TimeUnit.MILLISECONDS);
    } else {
        proxy = systemEventManager.get().createProxyWithAutoFlush(EventManager.class, 100, TimeUnit.MILLISECONDS);
    }

    eventManagerThreadLocal.set(proxy);
    return proxy;
}
 
开发者ID:advantageous,项目名称:qbit,代码行数:24,代码来源:BoonQBitFactory.java

示例4: createProxyWithChannelPrefix

import io.advantageous.qbit.events.EventManager; //导入依赖的package包/类
@Override
public <T> T createProxyWithChannelPrefix(final EventManager eventManager, final Class<T> eventBusProxyInterface,
                                          final String channelPrefix) {

    if (!eventBusProxyInterface.isInterface()) {
        throw new IllegalArgumentException("Must be an interface for eventBusProxyInterface argument");
    }
    final Map<String, String> methodToChannelMap = createMethodToChannelMap(channelPrefix, eventBusProxyInterface);

    final InvocationHandler invocationHandler = (proxy, method, args) -> {

        if (flushMethodNameSet.contains(method.getName())) {
            flushServiceProxy(eventManager);
            return null;
        }
        final String channelName = methodToChannelMap.get(method.toString());
        eventManager.sendArguments(channelName, args);

        return null;
    };
    final Object o = Proxy.newProxyInstance(eventBusProxyInterface.getClassLoader(), new Class[]{eventBusProxyInterface, ClientProxy.class}, invocationHandler);
    //noinspection unchecked
    return (T) o;

}
 
开发者ID:advantageous,项目名称:qbit,代码行数:26,代码来源:BoonEventBusProxyCreator.java

示例5: EventExampleService

import io.advantageous.qbit.events.EventManager; //导入依赖的package包/类
public EventExampleService(final EventManager eventManager,
                           final String statKeyPrefix,
                           final Reactor reactor,
                           final Timer timer,
                           final StatsCollector statsCollector) {
    super(statKeyPrefix, reactor, timer, statsCollector);
    this.eventManager = eventManager;
    reactor.addServiceToFlush(eventManager);
}
 
开发者ID:advantageous,项目名称:qbit-extensions,代码行数:10,代码来源:EventExampleService.java

示例6: eventBusCluster

import io.advantageous.qbit.events.EventManager; //导入依赖的package包/类
@Bean
public EventBusCluster eventBusCluster(final @Qualifier("clusteredEventManagerImpl") EventManager eventManager,
                                       final EventConnectorHub eventConnectorHub,
                                       final ServiceDiscovery serviceDiscovery,
                                       final EventBusProperties props) {

    logger.info("Binding event bus to " + props.getPort());
    final EventBusClusterBuilder clusterBuilder = EventBusClusterBuilder.eventBusClusterBuilder();
    clusterBuilder.setServiceDiscovery(serviceDiscovery);
    clusterBuilder.setReplicationPortLocal(props.getPort());
    clusterBuilder.setEventBusName(props.getName());
    clusterBuilder.setEventManager(eventManager);
    clusterBuilder.setEventConnectorHub(eventConnectorHub);
    clusterBuilder.setPeerCheckTimeUnit(TimeUnit.SECONDS);
    clusterBuilder.setPeerCheckTimeInterval(props.getPeriodicCheckInSeconds());
    clusterBuilder.setReplicationServerCheckInInterval(props.getTtl());
    clusterBuilder.setReplicationServerCheckInTimeUnit(TimeUnit.SECONDS);
    final EventBusCluster cluster = clusterBuilder.build();
    try {
        cluster.start();
    } catch (final Exception e) {
        logger.error("Failed to start cluster for event bus.  Make sure you can connect to consul.");
        logger.error("Consul is down.  The event bus predates ServiceDiscovery");
        logger.error("ServiceDiscovery will default to using JSON files for peer endpoint config.");
        logger.error("The stats count is using service discovery, event bus is not yet.");
    }
    return cluster;
}
 
开发者ID:advantageous,项目名称:qbit-extensions,代码行数:29,代码来源:ClusterConfiguration.java

示例7: clusteredEventManager

import io.advantageous.qbit.events.EventManager; //导入依赖的package包/类
@Bean
@Clustered
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public EventManager clusteredEventManager(final @Qualifier("clusteredEventManagerServiceQueue")
                                          ServiceQueue eventManagerServiceQueue) {

    return eventManagerServiceQueue.createProxy(EventManager.class);
}
 
开发者ID:advantageous,项目名称:qbit-extensions,代码行数:9,代码来源:ClusterConfiguration.java

示例8: clusteredEventManagerImpl

import io.advantageous.qbit.events.EventManager; //导入依赖的package包/类
/**
 * Wraps factory method call so we can provide another implementation of interface if needed.
 *
 * @param eventConnectorHub the cluster of event connectors
 * @return the event manager
 */
@Bean
public EventManager clusteredEventManagerImpl(final EventConnectorHub eventConnectorHub) {
    return EventManagerBuilder.eventManagerBuilder()
            .setEventConnector(eventConnectorHub)
            .setName("CLUSTERED_EVENT_MANAGER").build();
}
 
开发者ID:advantageous,项目名称:qbit-extensions,代码行数:13,代码来源:ClusterConfiguration.java

示例9: EventBusCluster

import io.advantageous.qbit.events.EventManager; //导入依赖的package包/类
public EventBusCluster(final EventManager eventManager,
                       final String eventBusName,
                       final EventConnectorHub eventConnectorHub,
                       final PeriodicScheduler periodicScheduler,
                       final int peerCheckTimeInterval,
                       final TimeUnit peerCheckTimeTimeUnit,
                       final int replicationServerCheckInInterval,
                       final TimeUnit replicationServerCheckInTimeUnit,
                       final ServiceDiscovery serviceDiscovery,
                       final int replicationPortLocal,
                       final String replicationHostLocal) {

    this.eventBusName = eventBusName;
    this.eventConnectorHub = eventConnectorHub == null ? new EventConnectorHub() : eventConnectorHub;
    this.periodicScheduler = periodicScheduler == null ?
            QBit.factory().periodicScheduler() : periodicScheduler;
    this.peerCheckTimeInterval = peerCheckTimeInterval;
    this.peerCheckTimeUnit = peerCheckTimeTimeUnit;
    this.eventManager = eventManager == null ? createEventManager() : wrapEventManager(eventManager);
    this.replicationServerCheckInIntervalInSeconds = (int) replicationServerCheckInTimeUnit.toSeconds(replicationServerCheckInInterval);
    this.serviceDiscovery = serviceDiscovery;

    this.replicationPortLocal = replicationPortLocal;

    this.replicationHostLocal = getHost(replicationHostLocal);

    this.servicePool = new ServicePool(eventBusName, null);

    endpointDefinition = serviceDiscovery.registerWithTTL(eventBusName, replicationHostLocal, replicationPortLocal,
            (int) replicationServerCheckInTimeUnit.toSeconds(replicationServerCheckInInterval));

    serviceDiscovery.checkInOk(endpointDefinition.getId());
}
 
开发者ID:advantageous,项目名称:qbit-extensions,代码行数:34,代码来源:EventBusCluster.java

示例10: wrapEventManager

import io.advantageous.qbit.events.EventManager; //导入依赖的package包/类
private EventManager wrapEventManager(final EventManager eventManager) {
    if (eventManager instanceof ClientProxy) {
        return eventManager;
    } else {
        eventManagerImpl = eventManager;
        eventServiceQueue = serviceBuilder().setServiceObject(eventManager).build();
        return eventServiceQueue.createProxyWithAutoFlush(EventManager.class, periodicScheduler,
                100, TimeUnit.MILLISECONDS);
    }
}
 
开发者ID:advantageous,项目名称:qbit-extensions,代码行数:11,代码来源:EventBusCluster.java

示例11: createEventManager

import io.advantageous.qbit.events.EventManager; //导入依赖的package包/类
private EventManager createEventManager() {
    eventManagerImpl = eventManagerBuilder().setEventConnector(eventConnectorHub).build(eventBusName);
    eventServiceQueue = serviceBuilder().setServiceObject(eventManagerImpl).build();

    return eventServiceQueue.createProxyWithAutoFlush(
            EventManager.class, periodicScheduler, 100, TimeUnit.MILLISECONDS);
}
 
开发者ID:advantageous,项目名称:qbit-extensions,代码行数:8,代码来源:EventBusCluster.java

示例12: setup

import io.advantageous.qbit.events.EventManager; //导入依赖的package包/类
@Before
public void setup() throws IOException {

    setupLatch();

    RegisterVertxWithQBit.registerVertxWithQBit();
    RegisterBoonWithQBit.registerBoonWithQBit();
    eventManager = mock(EventManager.class);
    service = new EventRemoteReplicatorService(eventManager);


    Sys.sleep(1000);
    int port = PortUtils.useOneOfThesePorts(3000, 6000, 4000, 3000);

    puts("findOpenPort(", port, ")");

    serviceEndpointServer = endpointServerBuilder().setPort(port).build();
    serviceEndpointServer.initServices(service);
    client = clientBuilder().setPort(port).build();

    Sys.sleep(1000);
    serviceEndpointServer.start();
    Sys.sleep(1000);
    client.start();

    clientEventConnector = client.createProxy(EventConnector.class, "eventRemoteReplicatorService");
    Sys.sleep(100);
}
 
开发者ID:advantageous,项目名称:qbit-extensions,代码行数:29,代码来源:EventRemoteReplicatorServiceEndpointServerIntegrationTest.java

示例13: setup

import io.advantageous.qbit.events.EventManager; //导入依赖的package包/类
@Before
public void setup() {
    setupLatch();
    eventManager = mock(EventManager.class);
    service = new EventRemoteReplicatorService(eventManager);

    try {
        serviceBundle = serviceBundleBuilder().build();
        serviceBundle.addServiceObject("remote", service);
        client = serviceBundle.createLocalProxy(EventConnector.class, "remote");
        serviceBundle.startUpCallQueue();
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
 
开发者ID:advantageous,项目名称:qbit-extensions,代码行数:16,代码来源:EventRemoteReplicatorServiceBundleIntegrationTest.java

示例14: getEventManager

import io.advantageous.qbit.events.EventManager; //导入依赖的package包/类
/**
 * Get event manager
 *
 * @return event manager
 */
public EventManager getEventManager() {
    if (eventManager == null) {
        eventManager = getFactory().systemEventManager();
    }
    return eventManager;
}
 
开发者ID:advantageous,项目名称:qbit,代码行数:12,代码来源:ManagedServiceBuilder.java

示例15: flushEventManagerCalls

import io.advantageous.qbit.events.EventManager; //导入依赖的package包/类
private void flushEventManagerCalls() {
    final EventManager eventManager = factory.eventManagerProxy();
    if (eventManager != null) {
        ServiceProxyUtils.flushServiceProxy(eventManager);
        factory.clearEventManagerProxy();
    }
}
 
开发者ID:advantageous,项目名称:qbit,代码行数:8,代码来源:BaseServiceQueueImpl.java


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