成人国产在线小视频_日韩寡妇人妻调教在线播放_色成人www永久在线观看_2018国产精品久久_亚洲欧美高清在线30p_亚洲少妇综合一区_黄色在线播放国产_亚洲另类技巧小说校园_国产主播xx日韩_a级毛片在线免费

資訊專欄INFORMATION COLUMN

JCTools簡(jiǎn)介

YJNldm / 1244人閱讀

摘要:序是一款對(duì)并發(fā)數(shù)據(jù)結(jié)構(gòu)進(jìn)行增強(qiáng)的并發(fā)工具,主要提供了以及的增強(qiáng)數(shù)據(jù)結(jié)構(gòu)。只有幾個(gè)方法對(duì)比主要是操作之后沒(méi)有立即返回是對(duì)的增強(qiáng),對(duì)多的支持以及高并發(fā)更新提供更好的性能。是對(duì)的簡(jiǎn)單包裝以支持的接口。

JCTools是一款對(duì)jdk并發(fā)數(shù)據(jù)結(jié)構(gòu)進(jìn)行增強(qiáng)的并發(fā)工具,主要提供了map以及queue的增強(qiáng)數(shù)據(jù)結(jié)構(gòu)。原來(lái)netty還是自己寫(xiě)的MpscLinkedQueueNode,后來(lái)新版本就換成使用JCTools的并發(fā)隊(duì)列了。

增強(qiáng)map

ConcurrentAutoTable(后面幾個(gè)map/set結(jié)構(gòu)的基礎(chǔ))

NonBlockingHashMap

NonBlockingHashMapLong

NonBlockingHashSet

NonBlockingIdentityHashMap

NonBlockingSetInt

增強(qiáng)隊(duì)列

SPSC - Single Producer Single Consumer (Wait Free, bounded and unbounded)

MPSC - Multi Producer Single Consumer (Lock less, bounded and unbounded)

SPMC - Single Producer Multi Consumer (Lock less, bounded)

MPMC - Multi Producer Multi Consumer (Lock less, bounded)

maven
        
            org.jctools
            jctools-core
            2.1.0
        
ConcurrentAutoTable

替代AtomicLong,專門為高性能的counter設(shè)計(jì)的。只有幾個(gè)方法

public void add( long x );
public void decrement();
public void increment();
public void set( long x );
public long get();
public int  intValue();
public long longValue();
public long estimate_get();

對(duì)比AtomicLong主要是操作之后沒(méi)有立即返回

public final long incrementAndGet();
public final long decrementAndGet()
NonBlockingHashMap

NonBlockingHashMap是對(duì)ConcurrentHashMap的增強(qiáng),對(duì)多CPU的支持以及高并發(fā)更新提供更好的性能。
NonBlockingHashMapLong是key為L(zhǎng)ong型的NonBlockingHashMap。
NonBlockingHashSet是對(duì)NonBlockingHashMap的簡(jiǎn)單包裝以支持set的接口。
NonBlockingIdentityHashMap是從NonBlockingHashMap改造來(lái)的,使用System.identityHashCode()來(lái)計(jì)算哈希
NonBlockingSetInt是一個(gè)使用CAS的簡(jiǎn)單的bit-vector

原來(lái)是

// --- hash ----------------------------------------------------------------
  // Helper function to spread lousy hashCodes.  Throws NPE for null Key, on
  // purpose - as the first place to conveniently toss the required NPE for a
  // null Key.
  private static final int hash(final Object key) {
    int h = key.hashCode();     // The real hashCode call
    h ^= (h>>>20) ^ (h>>>12);
    h ^= (h>>> 7) ^ (h>>> 4);
    h += h<<7; // smear low bits up high, for hashcodes that only differ by 1
    return h;
  }

改為

// --- hash ----------------------------------------------------------------
  // Helper function to spread lousy hashCodes
  private static final int hash(final Object key) {
    int h = System.identityHashCode(key); // The real hashCode call
    // I assume that System.identityHashCode is well implemented with a good
    // spreader, and a second bit-spreader is redundant.
    //h ^= (h>>>20) ^ (h>>>12);
    //h ^= (h>>> 7) ^ (h>>> 4);
    return h;
  }
doc

JCTools

Java Concurrent Counters By Numbers

Lock Free Queues Index

135 Million messages a second between processes in pure Java

文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。

轉(zhuǎn)載請(qǐng)注明本文地址:http://systransis.cn/yun/70324.html

相關(guān)文章

  • 記JVM堆外內(nèi)存泄漏Bug查找

    摘要:服務(wù)本身是一個(gè),開(kāi)起的線程數(shù)為,再加上一些其他線程,總的線程數(shù)不會(huì)超過(guò)服務(wù)內(nèi)自己沒(méi)有顯示創(chuàng)建線程或者使用線程池。問(wèn)題解決找到所在后,結(jié)局方案很簡(jiǎn)單,只需將的通過(guò)單例的方式注入到服務(wù)中,即可解決堆外內(nèi)存泄漏的問(wèn)題。 內(nèi)存泄漏Bug現(xiàn)場(chǎng) 一個(gè)做BI數(shù)據(jù)展示的服務(wù)在一個(gè)晚上重啟了5次,由于是通過(guò)k8s容器編排,服務(wù)掛了以后會(huì)自動(dòng)重啟,所以服務(wù)還能繼續(xù)提供服務(wù)。 第一時(shí)間先上日志系統(tǒng)查看錯(cuò)誤日...

    hiYoHoo 評(píng)論0 收藏0
  • 值得收藏!國(guó)外最佳互聯(lián)網(wǎng)安全博客TOP 30

    摘要:最近有國(guó)外網(wǎng)站對(duì)多個(gè)互聯(lián)網(wǎng)安全博客做了相關(guān)排名,小編整理其中排名前的安全博客,希望能給大家?guī)?lái)一些幫助。文章更新頻率篇周地址簡(jiǎn)介谷歌在互聯(lián)網(wǎng)安全的新聞和見(jiàn)解。其安全部分致力于分析最新的惡意軟件威脅和漏洞。 如果你是網(wǎng)絡(luò)安全從業(yè)人員,其中重要的工作便是了解安全行業(yè)的最新資訊以及技術(shù)趨勢(shì),那么瀏覽各大安全博客網(wǎng)站或許是信息來(lái)源最好的方法之一。最近有國(guó)外網(wǎng)站對(duì)50多個(gè)互聯(lián)網(wǎng)安全博客做了相關(guān)排...

    mmy123456 評(píng)論0 收藏0

發(fā)表評(píng)論

0條評(píng)論

最新活動(dòng)
閱讀需要支付1元查看
<