release Ui Semaphore - Java java.util.concurrent

Java examples for java.util.concurrent:Semaphore

Description

release Ui Semaphore

Demo Code


    //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*/
            });
        }
    }

Related Tutorials