MemCachedClient調用,報java.lang.ArrayIndexOutOfBoundsException錯誤

來源:互聯網
上載者:User

java.util.concurrent.ExecutionException: java.lang.ArrayIndexOutOfBoundsException
        at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)
        at java.util.concurrent.FutureTask.get(FutureTask.java:83)
        at com.wonibo.projectx.service.index.ReadPsDaemon.getResult(ReadPsDaemon.java:109)
        at com.wonibo.projectx.service.index.ReadPsDaemon.readPs(ReadPsDaemon.java:97)
        at com.wonibo.projectx.service.index.ReadPsDaemon.run(ReadPsDaemon.java:54)
Caused by: java.lang.ArrayIndexOutOfBoundsException
        at java.lang.System.arraycopy(Native Method)
        at sun.security.provider.DigestBase.engineUpdate(DigestBase.java:110)
        at java.security.MessageDigest$Delegate.engineUpdate(MessageDigest.java:537)
        at java.security.MessageDigest.update(MessageDigest.java:293)
        at com.danga.MemCached.SockIOPool.md5HashingAlg(SockIOPool.java:521)
        at com.danga.MemCached.SockIOPool.getHash(SockIOPool.java:547)
        at com.danga.MemCached.SockIOPool.getBucket(SockIOPool.java:557)
        at com.danga.MemCached.SockIOPool.getSock(SockIOPool.java:918)
        at com.danga.MemCached.MemCachedClient.delete(MemCachedClient.java:447)
        at com.danga.MemCached.MemCachedClient.delete(MemCachedClient.java:395)
        at com.wonibo.projectx.dao.memcache.MemcachedUtil.remove(MemcachedUtil.java:167)
        at com.wonibo.projectx.dao.DbManager.getProductBeanStateById(DbManager.java:835)
        at com.wonibo.projectx.service.index.ReadPsDaemon$PsReader.call(ReadPsDaemon.java:133)
        at com.wonibo.projectx.service.index.ReadPsDaemon$PsReader.call(ReadPsDaemon.java:122)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:619)

原因是MessageDigest instance非安全執行緒的。如果要多線程調用需要syncronize,這不是最優解決辦法,不知有別的解決方案沒。

先記下來,以後再找解決方案。

類似問題:http://www.javaeye.com/topic/186965

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.