亚洲免费乱码视频,日韩 欧美 国产 动漫 一区,97在线观看免费视频播国产,中文字幕亚洲图片

      1. <legend id="ppnor"></legend>

      2. 
        
        <sup id="ppnor"><input id="ppnor"></input></sup>
        <s id="ppnor"></s>

        AnThreadGroupFactoryworkinmutiThread

        字號(hào):

        package thread;
            import java.util.concurrent.ThreadFactory;
            /**
            * Thread Factory with Thread Group, which can work in multi thread env,
            * can create thread by daemon flag, and named each thread in creating.
            *
            */
            class ThreadGroupFactory implements ThreadFactory{
            //attributes
            private ThreadGroup _threadGroup;
            private String _namePrefix;
            private boolean _createDaemonFlag;
            private int _numThreads;
            private final Object _synLock = new Object();
            //assign the thread group
            public ThreadGroupFactory(ThreadGroup threadGroup, String namePrefix) {
            _threadGroup=threadGroup;
            _namePrefix = namePrefix;
            _numThreads=0;
            }
            //use parent thread group
            public ThreadGroupFactory(String namePrefix) {
            this(Thread.currentThread().getThreadGroup(), namePrefix);
            }
            //assign the daemon flag
            public void createDaemonThreads(boolean createDaemonFlag){
            synchronized(_synLock){
            _createDaemonFlag=createDaemonFlag;
            }
            }
            @Override
            public Thread newThread(Runnable r) {
            String threadName;
            boolean daemonFlag;、
            synchronized(_synLock){
            threadName = _namePrefix + ++_numThreads;
            daemonFlag = _createDaemonFlag;
            }
            Thread thread = new Thread(_threadGroup, r, threadName);
            thread.setDaemon(daemonFlag);
            return thread;
            }
            }