Code example for ThreadFactory

Methods: newThread

0
        CustomThreadFactory(Thread.UncaughtExceptionHandler handler) { 
            this.handler = handler; 
        } 
 
        public Thread newThread(Runnable r) { 
            Thread t = defaultFactory.newThread(r); 
            t.setUncaughtExceptionHandler(handler); 
            return t; 
        } 
    }; 
 
    /** 
     * Returns the number of available processors. 
     *  
     * @return number of available processors 
     */ 
    public static int getNumberOfProcessors() { 
        return Runtime.getRuntime().availableProcessors(); 
    } 
 
    /**