@ Override public Thread newThread ( final Runnable runnable ) { Runnable wrapped = new Runnable ( ) { @ Override public void run ( ) { try { // As the runnable is wrapped in another runnable object, we call the run method directly. runnable . run ( ) ; //NOSONAR } catch ( Exception e ) { //NOSONAR // Catching exception is acceptable here as the wrapped runnable can throw almost anything. log . error ( "Error while executing " + Thread . currentThread ( ) . getName ( ) , e ) ; } } } ; Thread thread = factory . newThread ( wrapped ) ; thread . setName ( prefix + "-" + thread . getName ( ) ) ; return thread ; }
Creates a new threads .