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


Java AsyncMultiMap类代码示例

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


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

示例1: getAsyncMultiMap

import io.vertx.core.spi.cluster.AsyncMultiMap; //导入依赖的package包/类
@Override
public <K, V> void getAsyncMultiMap(final String name, final Handler<AsyncResult<AsyncMultiMap<K, V>>> resultHandler) {
    ConcurrentMap map = asyncMultiMaps.get(name);
    if (map == null) {
        map = new ConcurrentHashMap<>();
        final ConcurrentMap prevMap = asyncMultiMaps.putIfAbsent(name, map);
        if (prevMap != null) {
            map = prevMap;
        }
    }
    @SuppressWarnings("unchecked") final ConcurrentMap<K, ChoosableSet<V>> theMap = map;
    this.vertx.runOnContext(v -> resultHandler.handle(Future.succeededFuture(new FakeAsyncMultiMap<>(theMap))));
}
 
开发者ID:silentbalanceyh,项目名称:vertx-zero,代码行数:14,代码来源:FakeClusterManager.java

示例2: getAsyncMultiMap

import io.vertx.core.spi.cluster.AsyncMultiMap; //导入依赖的package包/类
@Override
public <K, V> void getAsyncMultiMap(String name, Handler<AsyncResult<AsyncMultiMap<K, V>>> resultHandler) {
  vertx.executeBlocking(future -> {
    Cache<MultiMapKey, Object> cache = cacheManager.getCache(name);
    InfinispanAsyncMultiMap<K, V> asyncMultiMap = new InfinispanAsyncMultiMap<>(vertx, cache);
    synchronized (this) {
      multimaps.add(asyncMultiMap);
    }
    future.complete(asyncMultiMap);
  }, false, resultHandler);
}
 
开发者ID:vert-x3,项目名称:vertx-infinispan,代码行数:12,代码来源:InfinispanClusterManager.java

示例3: getAsyncMultiMap

import io.vertx.core.spi.cluster.AsyncMultiMap; //导入依赖的package包/类
@Override
public <K, V> void getAsyncMultiMap(String name, Handler<AsyncResult<AsyncMultiMap<K, V>>> handler) {
  atomix.<K, V>consistentMultimapBuilder(name)
      .withSerializer(createSerializer())
      .withConsistency(Consistency.LINEARIZABLE)
      .withPersistence(Persistence.PERSISTENT)
      .withReplication(Replication.SYNCHRONOUS)
      .withRecovery(Recovery.RECOVER)
      .withMaxRetries(5)
      .buildAsync()
      .whenComplete(VertxFutures.convertHandler(
          handler, map -> new AtomixAsyncMultiMap<>(vertx, map.async()), vertx.getOrCreateContext()));
}
 
开发者ID:atomix,项目名称:atomix-vertx,代码行数:14,代码来源:AtomixClusterManager.java

示例4: getAsyncMultiMap

import io.vertx.core.spi.cluster.AsyncMultiMap; //导入依赖的package包/类
@Override
public <K, V> void getAsyncMultiMap(String name, Handler<AsyncResult<AsyncMultiMap<K, V>>> handler) {
  logTrace(() -> String.format("Create new AsyncMultiMap [%s] on address [%s]", name, address));
  vertx.executeBlocking((future) -> {
    checkCluster();
    AsyncMultiMap<K, V> map = cacheManager.<K, V>createAsyncMultiMap(name);
    future.complete(map);
  }, handler);
}
 
开发者ID:vert-x3,项目名称:vertx-jgroups,代码行数:10,代码来源:JGroupsClusterManager.java

示例5: getAsyncMultiMap

import io.vertx.core.spi.cluster.AsyncMultiMap; //导入依赖的package包/类
/**
 * Every eventbus handler has an ID. SubsMap (subscriber map) is a MultiMap which
 * maps handler-IDs with server-IDs and thus allows the eventbus to determine where
 * to send messages.
 *
 * @param name          A unique name by which the the MultiMap can be identified within the cluster.
 *                      See the cluster config file (e.g. cluster.xml in case of HazelcastClusterManager) for
 *                      additional MultiMap config parameters.
 * @param resultHandler handler receiving the multimap
 */
@Override
public <K, V> void getAsyncMultiMap(String name, Handler<AsyncResult<AsyncMultiMap<K, V>>> resultHandler) {
  vertx.executeBlocking(fut -> {
    com.hazelcast.core.MultiMap<K, V> multiMap = hazelcast.getMultiMap(name);
    HazelcastAsyncMultiMap<K, V> asyncMultiMap = new HazelcastAsyncMultiMap<>(vertx, multiMap);
    synchronized (this) {
      multimaps.add(asyncMultiMap);
    }
    fut.complete(asyncMultiMap);
  }, resultHandler);
}
 
开发者ID:vert-x3,项目名称:vertx-hazelcast,代码行数:22,代码来源:HazelcastClusterManager.java

示例6: getAsyncMultiMap

import io.vertx.core.spi.cluster.AsyncMultiMap; //导入依赖的package包/类
@Override
public <K, V> void getAsyncMultiMap(String name, Handler<AsyncResult<AsyncMultiMap<K, V>>> handler) {
  vertx.executeBlocking(
    fut -> fut.complete(new AsyncMultiMapImpl<>(this.<K, Set<V>>getCache(name), vertx)), handler
  );
}
 
开发者ID:vert-x3,项目名称:vertx-ignite,代码行数:7,代码来源:IgniteClusterManager.java

示例7: createAsyncMultiMap

import io.vertx.core.spi.cluster.AsyncMultiMap; //导入依赖的package包/类
public <K, V> AsyncMultiMap<K, V> createAsyncMultiMap(String name) {
    logDebug(() -> String.format("method createAsyncMultiMap address[%s] name[%s]", channel.getAddressAsString(), name));
    MultiMap<K, V> map = multiMapService.<K, V>multiMapCreate(name);
    return new AsyncMultiMapWrapper<>(name, map, executorService);
}
 
开发者ID:vert-x3,项目名称:vertx-jgroups,代码行数:6,代码来源:CacheManager.java

示例8: getAsyncMultiMap

import io.vertx.core.spi.cluster.AsyncMultiMap; //导入依赖的package包/类
/**
 * Every eventbus handler has an ID. SubsMap (subscriber map) is a MultiMap which
 * maps handler-IDs with server-IDs and thus allows the eventbus to determine where
 * to send messages.
 *
 * @param name A unique name by which the the MultiMap can be identified within the cluster.
 *             See the cluster config file (e.g. io.vertx.spi.cluster.impl.zookeeper.zookeeper.properties in case of ZookeeperClusterManager) for
 *             additional MultiMap config parameters.
 * @return subscription map
 */
@Override
public <K, V> void getAsyncMultiMap(String name, Handler<AsyncResult<AsyncMultiMap<K, V>>> handler) {
  vertx.runOnContext(event -> handler.handle(Future.succeededFuture(new ZKAsyncMultiMap<>(vertx, curator, name))));
}
 
开发者ID:IBYoung,项目名称:vert.3x-gateway,代码行数:15,代码来源:ZookeeperClusterManager.java


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