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


Java ConcurrentHashMap.values方法代码示例

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


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

示例1: printUsage

import java.util.concurrent.ConcurrentHashMap; //导入方法依赖的package包/类
/**
 * Prints the applications help for available commands.
 *  @param out
 * @param commandList
 */
private void printUsage(final PrintStream out, final ConcurrentHashMap<String, Command> commandList) {
    out.println("Description:");
    out.println("  cljbuild is a clojure/jvm build too.");
    out.println("");
    out.println("Usage:");
    out.println("  cljbuild <command> [<command-options>]");
    out.println("");
    out.println("Available commands:");

    for (final Command c : commandList.values()) {
        final String target = c.getTarget();
        final int padLen = 14 - target.length();
        final char[] padding = new char[padLen];
        Arrays.fill(padding, ' ');

        out.print("  ");
        out.print(target);
        out.print(padding);
        out.print(" ");
        out.println(c.getDescription());
    }

    out.println("");
}
 
开发者ID:nfisher,项目名称:cljbuck,代码行数:30,代码来源:Main.java

示例2: addBlankFile

import java.util.concurrent.ConcurrentHashMap; //导入方法依赖的package包/类
public void addBlankFile(BlankFileMessage blankFileMessage) {
    int clientId = blankFileMessage.getClientId();
    int fileId = blankFileMessage.getFileId();

    Client client = clients.get(clientId);
    File clientFile = getOrCreateClientFile(fileId, client);

    ConcurrentHashMap<Long, Region> clientRegions = clientFile.getRegions();
    ConcurrentHashMap<Long, Region> serverRegions = files.get(fileId).getRegions();

    byte[] emptyByteArrayRegionSize = new byte[(int) REGION_SIZE];
    byte[] slowDigestForWholeEmptyRegion = Base64.getEncoder().encode(emptyByteArrayRegionSize);

    for (Region serverRegion : serverRegions.values()) {
        long offset = serverRegion.getOffset();
        long size = serverRegion.getSize();

        Region region = clientRegions.computeIfAbsent(offset, (aLong) ->
                new Region(offset, size));
        region.setQuickDigest(0);
        if(region.getSize() == REGION_SIZE) {
            region.setSlowDigest(slowDigestForWholeEmptyRegion);
        } else {
            byte[] emptyArraySmallerSize = new byte[(int) region.getSize()];
            region.setSlowDigest(
                    Base64.getEncoder()
                            .encode(emptyArraySmallerSize));
        }
    }
}
 
开发者ID:gaganis,项目名称:odoxSync,代码行数:31,代码来源:DirectorySynchronizer.java

示例3: getIt

import java.util.concurrent.ConcurrentHashMap; //导入方法依赖的package包/类
/**
 * Method handling HTTP GET requests. The returned object will be sent
 * to the client as "text/plain" media type.
 *
 * @return String that will be returned as a text/plain response.
 */
@GET
@Produces(MediaType.APPLICATION_JSON)
public Map<Integer, List<FileProgress>> getIt() {
    ConcurrentHashMap<Integer, Client> clients = DirectorySynchronizer.INSTANCE.clients;
    ConcurrentHashMap<Integer, File> serverFiles = DirectorySynchronizer.INSTANCE.files;

    Map<Integer, List<FileProgress>> result = new HashMap<>();

    for (Client client : clients.values()) {

        List<FileProgress> fileProgresses = getFileProgresses(serverFiles, client);
        result.put(client.getId(), fileProgresses);
    }
    return result;
}
 
开发者ID:gaganis,项目名称:odoxSync,代码行数:22,代码来源:Progress.java

示例4: getNeighborChildrenCount

import java.util.concurrent.ConcurrentHashMap; //导入方法依赖的package包/类
/**
 * we do it in a hack way.
 * travel the dom tree, to get how many children does this slider-neighbor have.
 *
 * @return
 */
private int getNeighborChildrenCount() {

    try {
        WXDomManager domManager = WXSDKManager.getInstance().getWXDomManager();
        Field domRegistriesField = domManager.getClass().getDeclaredField("mDomRegistries");
        domRegistriesField.setAccessible(true);
        ConcurrentHashMap<String, Object> domRegistriesMap = (ConcurrentHashMap<String, Object>) domRegistriesField.get(domManager);
        Object domStatement = domRegistriesMap.get(getInstanceId()); // WXDomStatement
        Field mRegistryField = domStatement.getClass().getDeclaredField("mRegistry");
        mRegistryField.setAccessible(true);
        ConcurrentHashMap<String, WXDomObject> mRegistryMap = (ConcurrentHashMap<String, WXDomObject>) mRegistryField.get(domStatement);
        for(WXDomObject domObject : mRegistryMap.values()) {
            if(domObject.getType().equalsIgnoreCase(WXBasicComponentType.SLIDER_NEIGHBOR)) {
                int sum = 0;
                for (int i = 0,count = domObject.getChildCount(); i < count; i++) {
                    if(domObject.getChild(i) instanceof WXIndicator.IndicatorDomNode) {
                        continue;
                    }
                    sum++;
                }
                return sum;
            }
        }
    } catch (Exception e) {
        // ignore
    }

    return -1;

}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:37,代码来源:WXSliderNeighbor.java

示例5: cleanUnusedTopic

import java.util.concurrent.ConcurrentHashMap; //导入方法依赖的package包/类
@Override
public int cleanUnusedTopic(Set<String> topics) {
    Iterator<Entry<String, ConcurrentHashMap<Integer, ConsumeQueue>>> it = this.consumeQueueTable.entrySet().iterator();
    while (it.hasNext()) {
        Entry<String, ConcurrentHashMap<Integer, ConsumeQueue>> next = it.next();
        String topic = next.getKey();
        if (!topics.contains(topic) && !topic.equals(ScheduleMessageService.SCHEDULE_TOPIC)) {
            ConcurrentHashMap<Integer, ConsumeQueue> queueTable = next.getValue();
            for (ConsumeQueue cq : queueTable.values()) {
                cq.destroy();
                log.info("cleanUnusedTopic: {} {} ConsumeQueue cleaned",//
                    cq.getTopic(), //
                    cq.getQueueId() //
                );

                this.commitLog.removeQueurFromTopicQueueTable(cq.getTopic(), cq.getQueueId());
            }
            it.remove();

            log.info("cleanUnusedTopic: {},topic destroyed", topic);
        }
    }

    return 0;
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:26,代码来源:DefaultMessageStore.java

示例6: removeOldest

import java.util.concurrent.ConcurrentHashMap; //导入方法依赖的package包/类
/**
 * Sort QueryStats by last invocation time
 * @param queries
 */
protected void removeOldest(ConcurrentHashMap<String,QueryStats> queries) {
    ArrayList<QueryStats> list = new ArrayList<QueryStats>(queries.values());
    Collections.sort(list, queryStatsComparator);
    int removeIndex = 0;
    while (queries.size() > maxQueries) {
        String sql = list.get(removeIndex).getQuery();
        queries.remove(sql);
        if (log.isDebugEnabled()) log.debug("Removing slow query, capacity reached:"+sql);
        removeIndex++;
    }
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:16,代码来源:SlowQueryReport.java

示例7: cleanUnusedTopic

import java.util.concurrent.ConcurrentHashMap; //导入方法依赖的package包/类
@Override
public int cleanUnusedTopic(Set<String> topics) {
    Iterator<Entry<String, ConcurrentHashMap<Integer, ConsumeQueue>>> it = this.consumeQueueTable.entrySet().iterator();
    while (it.hasNext()) {
        Entry<String, ConcurrentHashMap<Integer, ConsumeQueue>> next = it.next();
        String topic = next.getKey();

        if (!topics.contains(topic) && !topic.equals(ScheduleMessageService.SCHEDULE_TOPIC)) {
            ConcurrentHashMap<Integer, ConsumeQueue> queueTable = next.getValue();
            for (ConsumeQueue cq : queueTable.values()) {
                cq.destroy();
                log.info("cleanUnusedTopic: {} {} ConsumeQueue cleaned", //
                    cq.getTopic(), //
                    cq.getQueueId() //
                );

                this.commitLog.removeQueueFromTopicQueueTable(cq.getTopic(), cq.getQueueId());
            }
            it.remove();

            log.info("cleanUnusedTopic: {},topic destroyed", topic);
        }
    }

    return 0;
}
 
开发者ID:lyy4j,项目名称:rmq4note,代码行数:27,代码来源:DefaultMessageStore.java

示例8: recoverConsumeQueue

import java.util.concurrent.ConcurrentHashMap; //导入方法依赖的package包/类
private void recoverConsumeQueue() {
    for (ConcurrentHashMap<Integer, ConsumeQueue> maps : this.consumeQueueTable.values()) {
        for (ConsumeQueue logic : maps.values()) {
            logic.recover();
        }
    }
}
 
开发者ID:lyy4j,项目名称:rmq4note,代码行数:8,代码来源:DefaultMessageStore.java

示例9: recoverMessageQueue

import java.util.concurrent.ConcurrentHashMap; //导入方法依赖的package包/类
/**
 * recover topic message queue
 */
public void recoverMessageQueue() {
    for (ConcurrentHashMap<Integer, MessageQueueValue> mqs : mqMap.values()) {
        for (MessageQueueValue v : mqs.values()) {
            if (v.getMessageQueue() != null) {
                v.getMessageQueue().recover();
            }
        }
    }
}
 
开发者ID:taobaorun,项目名称:LiQ,代码行数:13,代码来源:MessageQueueHolder.java

示例10: doFlush

import java.util.concurrent.ConcurrentHashMap; //导入方法依赖的package包/类
private void doFlush(int retryTimes) {
    //获取默认刷屏缓存页大小   2
    int flushConsumeQueueLeastPages = DefaultMessageStore.this.getMessageStoreConfig().getFlushConsumeQueueLeastPages();

    if (retryTimes == RETRY_TIMES_OVER) {
        flushConsumeQueueLeastPages = 0;
    }

    long logicsMsgTimestamp = 0;

    //彻底刷屏间隔  1000 * 60
    int flushConsumeQueueThoroughInterval = DefaultMessageStore.this.getMessageStoreConfig().getFlushConsumeQueueThoroughInterval();
    long currentTimeMillis = System.currentTimeMillis();
    if (currentTimeMillis >= (this.lastFlushTimestamp + flushConsumeQueueThoroughInterval)) {
        this.lastFlushTimestamp = currentTimeMillis;
        flushConsumeQueueLeastPages = 0;
        //获取存储检查点的物理消息时间戳
        logicsMsgTimestamp = DefaultMessageStore.this.getStoreCheckpoint().getLogicsMsgTimestamp();
    }

    ConcurrentHashMap<String, ConcurrentHashMap<Integer, ConsumeQueue>> tables = DefaultMessageStore.this.consumeQueueTable;

    for (ConcurrentHashMap<Integer, ConsumeQueue> maps : tables.values()) {
        //ConsumeQueue 自己维护物理存储抽象类
        for (ConsumeQueue cq : maps.values()) {
            boolean result = false;
            for (int i = 0; i < retryTimes && !result; i++) {
                result = cq.flush(flushConsumeQueueLeastPages);
            }
        }
    }

    if (0 == flushConsumeQueueLeastPages) {
        if (logicsMsgTimestamp > 0) {
            DefaultMessageStore.this.getStoreCheckpoint().setLogicsMsgTimestamp(logicsMsgTimestamp);
        }
        DefaultMessageStore.this.getStoreCheckpoint().flush();
    }
}
 
开发者ID:lyy4j,项目名称:rmq4note,代码行数:40,代码来源:DefaultMessageStore.java

示例11: execute

import java.util.concurrent.ConcurrentHashMap; //导入方法依赖的package包/类
public static void execute(ManagerConnection c) {
    ByteBuffer buffer = c.allocate();

    // write header
    buffer = header.write(buffer, c,true);

    // write fields
    for (FieldPacket field : fields) {
        buffer = field.write(buffer, c,true);
    }

    // write eof
    buffer = eof.write(buffer, c,true);

    // write rows
    byte packetId = eof.packetId;     
    int i=0;
    Map<String, UserStat> statMap = UserStatAnalyzer.getInstance().getUserStatMap();
	for (UserStat userStat : statMap.values()) {
    	String user = userStat.getUser();        
    	ConcurrentHashMap<String, SqlResultSet> map=userStat.getSqlResultSizeRecorder().getSqlResultSet();
         if ( map != null ) { 
 	        for (SqlResultSet sqlResultSet:map.values()) {
 	        	RowDataPacket row = getRow(++i, user,sqlResultSet.getSql(), sqlResultSet.getCount(), sqlResultSet.getResultSetSize(),c.getCharset());
 	            row.packetId = ++packetId;
 	            buffer = row.write(buffer, c,true);
 	        }
         }
	}    
    // write last eof
    EOFPacket lastEof = new EOFPacket();
    lastEof.packetId = ++packetId;
    buffer = lastEof.write(buffer, c,true);

    // write buffer
    c.write(buffer);
}
 
开发者ID:huang-up,项目名称:mycat-src-1.6.1-RELEASE,代码行数:38,代码来源:ShowSqlResultSet.java

示例12: addEdges

import java.util.concurrent.ConcurrentHashMap; //导入方法依赖的package包/类
private void addEdges(final Tracer tracer, final MutableGraph<BuildRule> graph, final ConcurrentHashMap<String, BuildRule> nodeMap) {
    tracer.info(started(hashCode).toString());
    for (final BuildRule buildRuleV : nodeMap.values()) {
        for (final String predecessor : buildRuleV.getDeps()) {
            final BuildRule buildRuleU = nodeMap.get(predecessor);
            if (null == buildRuleU) {
                System.err.println("Unable to find " + predecessor);
                continue;
            }
            graph.putEdge(buildRuleU, buildRuleV);
        }
    }
    tracer.info(finished(hashCode).toString());
}
 
开发者ID:nfisher,项目名称:cljbuck,代码行数:15,代码来源:Rules.java

示例13: truncateDirtyLogicFiles

import java.util.concurrent.ConcurrentHashMap; //导入方法依赖的package包/类
public void truncateDirtyLogicFiles(long phyOffset) {
    ConcurrentHashMap<String, ConcurrentHashMap<Integer, ConsumeQueue>> tables = DefaultMessageStore.this.consumeQueueTable;

    for (ConcurrentHashMap<Integer, ConsumeQueue> maps : tables.values()) {
        for (ConsumeQueue logic : maps.values()) {
            logic.truncateDirtyLogicFiles(phyOffset);
        }
    }
}
 
开发者ID:lyy4j,项目名称:rmq4note,代码行数:10,代码来源:DefaultMessageStore.java

示例14: destroyLogics

import java.util.concurrent.ConcurrentHashMap; //导入方法依赖的package包/类
public void destroyLogics() {
    for (ConcurrentHashMap<Integer, ConsumeQueue> maps : this.consumeQueueTable.values()) {
        for (ConsumeQueue logic : maps.values()) {
            logic.destroy();
        }
    }
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:8,代码来源:DefaultMessageStore.java

示例15: recoverTopicQueueTable

import java.util.concurrent.ConcurrentHashMap; //导入方法依赖的package包/类
private void recoverTopicQueueTable() {
    HashMap<String/* topic-queueid */, Long/* offset */> table = new HashMap<String, Long>(1024);
    long minPhyOffset = this.commitLog.getMinOffset();
    for (ConcurrentHashMap<Integer, ConsumeQueue> maps : this.consumeQueueTable.values()) {
        for (ConsumeQueue logic : maps.values()) {
            String key = logic.getTopic() + "-" + logic.getQueueId();
            table.put(key, logic.getMaxOffsetInQuque());
            logic.correctMinOffset(minPhyOffset);
        }
    }

    this.commitLog.setTopicQueueTable(table);
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:14,代码来源:DefaultMessageStore.java


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