Home | History | Annotate | Download | only in format
      1 //  2016 and later: Unicode, Inc. and others.
      2 // License & terms of use: http://www.unicode.org/copyright.html#License
      3 
      4 package com.ibm.icu.dev.test.format;
      5 
      6 import org.junit.Test;
      7 import org.junit.runner.RunWith;
      8 import org.junit.runners.JUnit4;
      9 
     10 import com.ibm.icu.dev.test.TestFmwk;
     11 import com.ibm.icu.util.Currency;
     12 import com.ibm.icu.util.MeasureUnit;
     13 import com.ibm.icu.util.ULocale;
     14 
     15 @RunWith(JUnit4.class)
     16 public class MeasureUnitThreadTest extends TestFmwk {
     17 
     18     @Test
     19     public void MUThreadTest() {
     20         // Ticket #12034 deadlock on multi-threaded static init of MeasureUnit.
     21         // The code below reliably deadlocks with ICU 56.
     22         // The test is here in its own file so it can be made to run independent of anything else.
     23         Thread thread = new Thread()  {
     24             @Override
     25             public void run() {
     26                 MeasureUnit.getAvailableTypes();
     27             }
     28         };
     29         thread.start();
     30         Currency.getInstance(ULocale.ENGLISH);
     31         try {thread.join();} catch(InterruptedException e) {};
     32     }
     33 }
     34 
     35