EmSupplierTest.java 文件源码

java
阅读 24 收藏 0 点赞 0 评论 0

项目:aries-jpa 作者:
@Test
public void asyncCleanLifeCycleTest() throws InterruptedException {
    EntityManagerFactory emf = mockEmf();
    final Coordinator coordinator = new DummyCoordinator();
    final EMSupplierImpl emSupplier = new EMSupplierImpl("myunit", emf,coordinator);
    final Semaphore preCallSem = new Semaphore(0);
    Runnable command = new Runnable() {

        @Override
        public void run() {
            coordinator.begin("test", 0);
            preCallSem.release();
            coordinator.pop().end();
        }
    };
    Executors.newSingleThreadExecutor().execute(command);
    preCallSem.acquire();
    // EMs not closed when close is called but are closed before timeout 
    boolean clean = emSupplier.close();
    Assert.assertTrue("Shutdown should be clean", clean);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号