public ExecutionBridge launch ( final IJob _job , final String _jobName ) throws EFapsException { // we are on WEB thread so services should be normally injected. final ExecutionBridge bridge = new ExecutionBridge ( ) ; // register bridge on session if ( _jobName == null ) { bridge . setJobName ( "EFapsJob-" + EFapsSession . get ( ) . countJobs ( ) + 1 + "-" + RandomUtil . randomAlphanumeric ( 4 ) ) ; } else { bridge . setJobName ( _jobName ) ; } bridge . setJobContext ( new JobContext ( ) . setUserName ( Context . getThreadContext ( ) . getPerson ( ) . getName ( ) ) . setLocale ( Context . getThreadContext ( ) . getLocale ( ) ) . setCompanyUUID ( Context . getThreadContext ( ) . getCompany ( ) . getUUID ( ) ) ) ; EFapsSession . get ( ) . addExecutionBridge ( bridge ) ; // run the task this . executorService . execute ( new JobRunnable ( _job , bridge ) ) ; return bridge ; }
Launch a job .