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


Java ConcurrentMap.keySet方法代码示例

本文整理汇总了Java中java.util.concurrent.ConcurrentMap.keySet方法的典型用法代码示例。如果您正苦于以下问题:Java ConcurrentMap.keySet方法的具体用法?Java ConcurrentMap.keySet怎么用?Java ConcurrentMap.keySet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.concurrent.ConcurrentMap的用法示例。


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

示例1: fetchMessageQueuesInBalance

import java.util.concurrent.ConcurrentMap; //导入方法依赖的package包/类
public Set<MessageQueue> fetchMessageQueuesInBalance(String topic) throws MQClientException {
    this.makeSureStateOK();
    if (null == topic) {
        throw new IllegalArgumentException("topic is null");
    }

    ConcurrentMap<MessageQueue, ProcessQueue> mqTable = this.rebalanceImpl.getProcessQueueTable();
    Set<MessageQueue> mqResult = new HashSet<MessageQueue>();
    for (MessageQueue mq : mqTable.keySet()) {
        if (mq.getTopic().equals(topic)) {
            mqResult.add(mq);
        }
    }

    return mqResult;
}
 
开发者ID:lirenzuo,项目名称:rocketmq-rocketmq-all-4.1.0-incubating,代码行数:17,代码来源:DefaultMQPullConsumerImpl.java

示例2: anyMatch

import java.util.concurrent.ConcurrentMap; //导入方法依赖的package包/类
public static RegExp anyMatch(String input, ConcurrentMap<RegExp, Pattern> eventPatterns) {

        RegExp foundEvent = null;

        Matcher matcher;
        Set<RegExp> keys = eventPatterns.keySet();
        for (RegExp event : keys) {
            Pattern pattern = eventPatterns.get(event);
            matcher = pattern.matcher(input);
            if (matcher.find()) {
                foundEvent = event;
                break;
            }
        }
        return foundEvent;
    }
 
开发者ID:ripreal,项目名称:V8LogScanner,代码行数:17,代码来源:RgxOpManager.java

示例3: getOvsUuid

import java.util.concurrent.ConcurrentMap; //导入方法依赖的package包/类
@Override
public String getOvsUuid(String dbName) {
    OvsdbRowStore rowStore = getRowStore(OvsdbConstant.DATABASENAME,
                                         OvsdbConstant.DATABASENAME);
    if (rowStore == null) {
        log.debug("The bridge uuid is null");
        return null;
    }
    ConcurrentMap<String, Row> ovsTableRows = rowStore.getRowStore();
    if (ovsTableRows != null) {
        for (String uuid : ovsTableRows.keySet()) {
            Row row = ovsTableRows.get(uuid);
            String tableName = row.tableName();
            if (tableName.equals(dbName)) {
                return uuid;
            }
        }
    }
    return null;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:21,代码来源:DefaultOvsdbClient.java

示例4: getBridges

import java.util.concurrent.ConcurrentMap; //导入方法依赖的package包/类
@Override
public Set<OvsdbBridge> getBridges() {
    Set<OvsdbBridge> ovsdbBridges = new HashSet<OvsdbBridge>();
    OvsdbTableStore tableStore = getTableStore(OvsdbConstant.DATABASENAME);
    if (tableStore == null) {
        return null;
    }
    OvsdbRowStore rowStore = tableStore.getRows(OvsdbConstant.BRIDGE);
    if (rowStore == null) {
        return null;
    }
    ConcurrentMap<String, Row> rows = rowStore.getRowStore();
    for (String uuid : rows.keySet()) {
        Row row = getRow(OvsdbConstant.DATABASENAME, OvsdbConstant.BRIDGE,
                         uuid);
        OvsdbBridge ovsdbBridge = getOvsdbBridge(row);
        if (ovsdbBridge != null) {
            ovsdbBridges.add(ovsdbBridge);
        }
    }
    return ovsdbBridges;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:23,代码来源:DefaultOvsdbClient.java

示例5: getPorts

import java.util.concurrent.ConcurrentMap; //导入方法依赖的package包/类
@Override
public Set<OvsdbPort> getPorts() {
    Set<OvsdbPort> ovsdbPorts = new HashSet<OvsdbPort>();
    OvsdbTableStore tableStore = getTableStore(OvsdbConstant.DATABASENAME);
    if (tableStore == null) {
        return null;
    }
    OvsdbRowStore rowStore = tableStore.getRows(OvsdbConstant.INTERFACE);
    if (rowStore == null) {
        return null;
    }
    ConcurrentMap<String, Row> rows = rowStore.getRowStore();
    for (String uuid : rows.keySet()) {
        Row row = getRow(OvsdbConstant.DATABASENAME,
                         OvsdbConstant.INTERFACE, uuid);
        OvsdbPort ovsdbPort = getOvsdbPort(row);
        if (ovsdbPort != null) {
            ovsdbPorts.add(ovsdbPort);
        }
    }
    return ovsdbPorts;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:23,代码来源:DefaultOvsdbClient.java

示例6: verify

import java.util.concurrent.ConcurrentMap; //导入方法依赖的package包/类
/**
 * @param wallClses
 * @param keysRef
 * @return
 */
private JsonObject verify(final Set<Class<?>> wallClses,
                          final ConcurrentMap<String, Class<?>> keysRef) {
    /** Wall duplicated **/
    final Set<String> hashs = new HashSet<>();
    Observable.fromIterable(wallClses)
            .filter(Objects::nonNull)
            .map(item -> {
                final Annotation annotation = item.getAnnotation(Wall.class);
                // Add configuration key into keys;
                keysRef.put(Instance.invoke(annotation, "value"), item);
                return this.hashPath(annotation);
            }).subscribe(hashs::add);
    
    // Duplicated adding.
    Fn.flingUp(hashs.size() != wallClses.size(), LOGGER,
            WallDuplicatedException.class, getClass(),
            wallClses.stream().map(Class::getName).collect(Collectors.toSet()));

    /** Shared key does not existing **/
    final JsonObject config = NODE.read();
    Fn.flingUp(!config.containsKey(KEY), LOGGER,
            DynamicKeyMissingException.class, getClass(),
            KEY, config);

    /** Wall key missing **/
    final JsonObject hitted = config.getJsonObject(KEY);
    for (final String key : keysRef.keySet()) {
        Fn.flingUp(null == hitted || !hitted.containsKey(key), LOGGER,
                WallKeyMissingException.class, getClass(),
                key, keysRef.get(key));
    }
    return hitted;
}
 
开发者ID:silentbalanceyh,项目名称:vertx-zero,代码行数:39,代码来源:WallInquirer.java

示例7: isAgentDefined

import java.util.concurrent.ConcurrentMap; //导入方法依赖的package包/类
/** **/
public static ConcurrentMap<ServerType, Boolean> isAgentDefined(
        final ConcurrentMap<ServerType, List<Class<?>>> agents,
        final Class<?>... exclude) {
    final Set<Class<?>> excludes = new HashSet<>(Arrays.asList(exclude));
    final ConcurrentMap<ServerType, Boolean> defined
            = new ConcurrentHashMap<>();
    for (final ServerType server : agents.keySet()) {
        final List<Class<?>> item = agents.get(server);
        // Filter to result.
        final List<Class<?>> filtered =
                item.stream()
                        .filter(each -> !excludes.contains(each))
                        .collect(Collectors.toList());
        // > 1 means duplicated defined
        final int size = filtered.size();
        Fn.flingUp(1 < size,
                LOGGER, AgentDuplicatedException.class,
                ZeroHelper.class, server, size,
                filtered.stream()
                        .map(Class::getName)
                        .collect(Collectors.toSet()));
        // == 0 means undefined
        // == 1 means correct defined
        defined.put(server, Values.ONE == size);
    }
    return defined;
}
 
开发者ID:silentbalanceyh,项目名称:vertx-zero,代码行数:29,代码来源:ZeroHelper.java

示例8: testAnnos

import java.util.concurrent.ConcurrentMap; //导入方法依赖的package包/类
@Test
public void testAnnos(final TestContext context) {
    final ConcurrentMap<String, Annotation> clazzes = Anno.get(AnnoOne.class);
    for (final String item : clazzes.keySet()) {
        System.out.println("key=" + item + ",value=" + clazzes.get(item));
    }
    context.assertEquals(2, clazzes.size());
}
 
开发者ID:silentbalanceyh,项目名称:vertx-zero,代码行数:9,代码来源:AnnoTc.java

示例9: getAllCaches

import java.util.concurrent.ConcurrentMap; //导入方法依赖的package包/类
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("cache")
public Response getAllCaches(){

    Map<String, Map<Object, Object>> finalRes = new HashMap<>();

    ConcurrentMap<Object, ConcurrentMap<Object, Object>> allCaches = cacheLocal.getAllCaches();
    if(allCaches != null) {

        Set<Object> keys = allCaches.keySet();

        if(keys != null){

            keys.stream().filter(key -> (key != null)).forEach(key -> {

                ConcurrentMap<Object, Object> oneCache = allCaches.get(key);

                Map<Object, Object> cacheAsMap = new HashMap<>();

                if(oneCache != null) {
                    oneCache.forEach((k, v) -> {
                            cacheAsMap.put(k,  v);
                    });
                    finalRes.put((String) key, cacheAsMap);
                }
            });
        }
    }
    GenericEntity<Map<String, Map<Object, Object>>> res = new GenericEntity<Map<String, Map<Object, Object>>>(finalRes){};
    return Response.ok().entity(res).build();
}
 
开发者ID:harperkej,项目名称:store-app-ee,代码行数:33,代码来源:PingRestResource.java

示例10: getBridgeUuid

import java.util.concurrent.ConcurrentMap; //导入方法依赖的package包/类
@Override
public String getBridgeUuid(String bridgeName) {
    DatabaseSchema dbSchema = schema.get(OvsdbConstant.DATABASENAME);

    OvsdbRowStore rowStore = getRowStore(OvsdbConstant.DATABASENAME,
                                         OvsdbConstant.BRIDGE);
    if (rowStore == null) {
        log.debug("The bridge uuid is null");
        return null;
    }

    ConcurrentMap<String, Row> bridgeTableRows = rowStore.getRowStore();
    if (bridgeTableRows == null) {
        log.debug("The bridge uuid is null");
        return null;
    }

    for (String uuid : bridgeTableRows.keySet()) {
        Bridge bridge = (Bridge) TableGenerator
                .getTable(dbSchema, bridgeTableRows.get(uuid),
                          OvsdbTable.BRIDGE);

        if (bridge.getName().equals(bridgeName)) {
            return uuid;
        }

    }
    return null;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:30,代码来源:DefaultOvsdbClient.java

示例11: getControllerUuid

import java.util.concurrent.ConcurrentMap; //导入方法依赖的package包/类
@Override
public String getControllerUuid(String controllerName,
                                String controllerTarget) {
    DatabaseSchema dbSchema = schema.get(OvsdbConstant.DATABASENAME);
    OvsdbRowStore rowStore = getRowStore(OvsdbConstant.DATABASENAME,
                                         OvsdbConstant.CONTROLLER);
    if (rowStore == null) {
        log.debug("The controller uuid is null");
        return null;
    }

    ConcurrentMap<String, Row> controllerTableRows = rowStore.getRowStore();
    if (controllerTableRows != null) {
        for (String uuid : controllerTableRows.keySet()) {

            Controller controller = (Controller) TableGenerator
                    .getTable(dbSchema, controllerTableRows.get(uuid),
                              OvsdbTable.CONTROLLER);
            String target = (String) controller.getTargetColumn().data();
            if (target.equalsIgnoreCase(controllerTarget)) {
                return uuid;
            }

        }
    }
    return null;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:28,代码来源:DefaultOvsdbClient.java

示例12: getLocalPorts

import java.util.concurrent.ConcurrentMap; //导入方法依赖的package包/类
@Override
public Set<OvsdbPort> getLocalPorts(Iterable<String> ifaceids) {
    Set<OvsdbPort> ovsdbPorts = new HashSet<OvsdbPort>();
    OvsdbTableStore tableStore = getTableStore(OvsdbConstant.DATABASENAME);
    if (tableStore == null) {
        return null;
    }
    OvsdbRowStore rowStore = tableStore.getRows(OvsdbConstant.INTERFACE);
    if (rowStore == null) {
        return null;
    }
    ConcurrentMap<String, Row> rows = rowStore.getRowStore();
    for (String uuid : rows.keySet()) {
        Row row = getRow(OvsdbConstant.DATABASENAME,
                         OvsdbConstant.INTERFACE, uuid);
        DatabaseSchema dbSchema = getDatabaseSchema(OvsdbConstant.DATABASENAME);
        Interface intf = (Interface) TableGenerator
                .getTable(dbSchema, row, OvsdbTable.INTERFACE);
        if (intf == null || getIfaceid(intf) == null) {
            continue;
        }
        String portName = intf.getName();
        Set<String> ifaceidSet = Sets.newHashSet(ifaceids);
        if (portName.startsWith("vxlan")
                || !ifaceidSet.contains(getIfaceid(intf))) {
            continue;
        }
        long ofPort = getOfPort(intf);
        if ((ofPort < 0) || (portName == null)) {
            continue;
        }

        OvsdbPort ovsdbPort = new OvsdbPort(new OvsdbPortNumber(ofPort),
                                            new OvsdbPortName(portName));
        if (ovsdbPort != null) {
            ovsdbPorts.add(ovsdbPort);
        }
    }
    return ovsdbPorts;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:41,代码来源:DefaultOvsdbClient.java


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