private < T > SwingWorker < T , T > studioProcess ( final int timeout , final Callable < T > c , final UnaryFunction < Callable < T > , T > f ) { final Callable < T > cw = new Callable < T > ( ) { public T call ( ) { final FutureTask < T > t = new FutureTask < T > ( c ) ; try { executor . submit ( t ) ; return t . get ( timeout , TimeUnit . SECONDS ) ; } catch ( Exception ex ) { ex . printStackTrace ( ) ; } // end of catch return null ; } } ; return new SwingWorker < T , T > ( ) { public T doInBackground ( ) throws Exception { try { f . apply ( cw ) ; } finally { model . setProcessing ( false ) ; } // end of finally return null ; } } ; }
Studio process .