Java examples for java.util.concurrent:Semaphore
release Ui Semaphore
//package com.java2s; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Semaphore; public class Main { private static final Semaphore uiSemaphore = new Semaphore(1); private static final ExecutorService singleExecutorService = Executors .newSingleThreadExecutor(); private static void releaseUiSemaphor() { singleExecutorService.submit(() -> { uiSemaphore.release();/*from w ww . ja va 2s .co m*/ }); } }