SmartXLS的线程锁定问题

时间:2017-11-03 21:15:32

标签: java multithreading performance thread-safety smartxls

当我们使用多线程环境运行时,我们一直看到SmartXLS的问题,是否有人遇到过问题? 我们正在使用java 1.7 SmartXLS 4.6

 java.lang.Thread.State: BLOCKED
    at com.smartxls.a.aj.a(SourceFile:44)
    - waiting to lock <6521da27> (a com.smartxls.a.ai$a) owned by "GS-jobListenerPollingContainer-3" t@70
    at com.smartxls.a.aj.a(SourceFile:38)
    at com.smartxls.a.aj.a(SourceFile:28)
    at com.smartxls.a.de.a(SourceFile:173)
    at com.smartxls.a.de.a(SourceFile:97)
    at com.smartxls.a.y.T(SourceFile:1598)
    at com.smartxls.a.y.Q(SourceFile:1340)
    at com.smartxls.a.bq.a(SourceFile:391)
    at com.smartxls.a.h.b(SourceFile:1220)
    at com.smartxls.a.h.a(SourceFile:279)
    at com.smartxls.ss.af.f(SourceFile:2009)
    at com.smartxls.ss.af.a(SourceFile:2635)
    at com.smartxls.ss.af.b(SourceFile:2673)
    at com.smartxls.ss.af.a(SourceFile:1181)
    at com.smartxls.ss.af.a(SourceFile:1198)
    at com.smartxls.ss.aj.a(SourceFile:7884)
    at com.smartxls.ss.aj.a(SourceFile:7874)
    at com.smartxls.WorkBook.write(SourceFile:2363)

1 个答案:

答案 0 :(得分:0)

您应该使用getLock / releaseLock来同步后台线程计算。

            try
            {
                workbook.getLock();
                workbook.read(...);
                ...
                workbook.write(...);
            }
            finally
            {
                workbook.releaseLock();
            }