Java Code Examples for org.springframework.scheduling.concurrent.ConcurrentTaskExecutor#setTaskDecorator()
The following examples show how to use
org.springframework.scheduling.concurrent.ConcurrentTaskExecutor#setTaskDecorator() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SpringAsynchConfig.java From Spring-5.0-Cookbook with MIT License | 6 votes |
@Bean("mvcTaskexecutor") @Override public Executor getAsyncExecutor() { ConcurrentTaskExecutor executor = new ConcurrentTaskExecutor( Executors.newFixedThreadPool(100)); executor.setTaskDecorator(new TaskDecorator() { @Override public Runnable decorate (Runnable runnable) { return () -> { long t = System.currentTimeMillis(); runnable.run(); logger.info("creating ConcurrentTaskExecutor thread pool...."); System.out.printf("Thread %s has a processing time: %s%n", Thread.currentThread().getName(), (System.currentTimeMillis() - t)); }; } }); return executor; }
Example 2
Source File: SpringAsynchConfig.java From Spring-5.0-Cookbook with MIT License | 6 votes |
@Bean("mvcTaskexecutor") @Override public Executor getAsyncExecutor() { ConcurrentTaskExecutor executor = new ConcurrentTaskExecutor( Executors.newFixedThreadPool(100)); executor.setTaskDecorator(new TaskDecorator() { @Override public Runnable decorate (Runnable runnable) { return () -> { long t = System.currentTimeMillis(); runnable.run(); logger.info("creating ConcurrentTaskExecutor thread pool...."); System.out.printf("Thread %s has a processing time: %s%n", Thread.currentThread().getName(), (System.currentTimeMillis() - t)); }; } }); return executor; }
Example 3
Source File: SpringAsynchConfig.java From Spring-5.0-Cookbook with MIT License | 6 votes |
@Bean("mvcTaskexecutor") @Override public Executor getAsyncExecutor() { ConcurrentTaskExecutor executor = new ConcurrentTaskExecutor( Executors.newFixedThreadPool(100)); executor.setTaskDecorator(new TaskDecorator() { @Override public Runnable decorate (Runnable runnable) { return () -> { long t = System.currentTimeMillis(); runnable.run(); System.out.printf("Thread %s has a processing time: %s%n", Thread.currentThread().getName(), (System.currentTimeMillis() - t)); }; } }); return executor; }
Example 4
Source File: SpringAsynchConfig.java From Spring-5.0-Cookbook with MIT License | 6 votes |
@Bean("mvcTaskexecutor") @Override public Executor getAsyncExecutor() { ConcurrentTaskExecutor executor = new ConcurrentTaskExecutor( Executors.newFixedThreadPool(100)); executor.setTaskDecorator(new TaskDecorator() { @Override public Runnable decorate (Runnable runnable) { return () -> { long t = System.currentTimeMillis(); runnable.run(); logger.info("creating ConcurrentTaskExecutor thread pool...."); System.out.printf("Thread %s has a processing time: %s%n", Thread.currentThread().getName(), (System.currentTimeMillis() - t)); }; } }); return executor; }
Example 5
Source File: SpringAsynchConfig.java From Spring-5.0-Cookbook with MIT License | 6 votes |
@Bean("mvcTaskexecutor") @Override public Executor getAsyncExecutor() { ConcurrentTaskExecutor executor = new ConcurrentTaskExecutor( Executors.newFixedThreadPool(100)); executor.setTaskDecorator(new TaskDecorator() { @Override public Runnable decorate (Runnable runnable) { return () -> { long t = System.currentTimeMillis(); runnable.run(); logger.info("creating ConcurrentTaskExecutor thread pool...."); System.out.printf("Thread %s has a processing time: %s%n", Thread.currentThread().getName(), (System.currentTimeMillis() - t)); }; } }); return executor; }
Example 6
Source File: SpringAsynchConfig.java From Spring-5.0-Cookbook with MIT License | 6 votes |
@Bean("mvcTaskexecutor") @Override public Executor getAsyncExecutor() { ConcurrentTaskExecutor executor = new ConcurrentTaskExecutor( Executors.newFixedThreadPool(100)); executor.setTaskDecorator(new TaskDecorator() { @Override public Runnable decorate (Runnable runnable) { return () -> { long t = System.currentTimeMillis(); runnable.run(); logger.info("creating ConcurrentTaskExecutor thread pool...."); System.out.printf("Thread %s has a processing time: %s%n", Thread.currentThread().getName(), (System.currentTimeMillis() - t)); }; } }); return executor; }
Example 7
Source File: SpringAsynchConfig.java From Spring-5.0-Cookbook with MIT License | 6 votes |
@Bean("mvcTaskexecutor") @Override public Executor getAsyncExecutor() { ConcurrentTaskExecutor executor = new ConcurrentTaskExecutor( Executors.newFixedThreadPool(100)); executor.setTaskDecorator(new TaskDecorator() { @Override public Runnable decorate (Runnable runnable) { return () -> { long t = System.currentTimeMillis(); runnable.run(); logger.info("creating ConcurrentTaskExecutor thread pool...."); System.out.printf("Thread %s has a processing time: %s%n", Thread.currentThread().getName(), (System.currentTimeMillis() - t)); }; } }); return executor; }
Example 8
Source File: SpringAsynchConfig.java From Spring-5.0-Cookbook with MIT License | 6 votes |
@Bean("mvcTaskexecutor") @Override public Executor getAsyncExecutor() { ConcurrentTaskExecutor executor = new ConcurrentTaskExecutor( Executors.newFixedThreadPool(100)); executor.setTaskDecorator(new TaskDecorator() { @Override public Runnable decorate (Runnable runnable) { return () -> { long t = System.currentTimeMillis(); runnable.run(); logger.info("creating ConcurrentTaskExecutor thread pool...."); System.out.printf("Thread %s has a processing time: %s%n", Thread.currentThread().getName(), (System.currentTimeMillis() - t)); }; } }); return executor; }
Example 9
Source File: SpringAsynchConfig.java From Spring-5.0-Cookbook with MIT License | 6 votes |
@Bean("mvcTaskexecutor") @Override public Executor getAsyncExecutor() { ConcurrentTaskExecutor executor = new ConcurrentTaskExecutor( Executors.newFixedThreadPool(100)); executor.setTaskDecorator(new TaskDecorator() { @Override public Runnable decorate (Runnable runnable) { return () -> { long t = System.currentTimeMillis(); runnable.run(); logger.info("creating ConcurrentTaskExecutor thread pool...."); System.out.printf("Thread %s has a processing time: %s%n", Thread.currentThread().getName(), (System.currentTimeMillis() - t)); }; } }); return executor; }
Example 10
Source File: SpringAsynchConfig.java From Spring-5.0-Cookbook with MIT License | 6 votes |
@Bean("mvcTaskexecutor") @Override public Executor getAsyncExecutor() { ConcurrentTaskExecutor executor = new ConcurrentTaskExecutor( Executors.newFixedThreadPool(100)); executor.setTaskDecorator(new TaskDecorator() { @Override public Runnable decorate (Runnable runnable) { return () -> { long t = System.currentTimeMillis(); runnable.run(); logger.info("creating ConcurrentTaskExecutor thread pool...."); System.out.printf("Thread %s has a processing time: %s%n", Thread.currentThread().getName(), (System.currentTimeMillis() - t)); }; } }); return executor; }
Example 11
Source File: SpringAsynchConfig.java From Spring-5.0-Cookbook with MIT License | 6 votes |
@Bean("mvcTaskexecutor") @Override public Executor getAsyncExecutor() { ConcurrentTaskExecutor executor = new ConcurrentTaskExecutor( Executors.newFixedThreadPool(100)); executor.setTaskDecorator(new TaskDecorator() { @Override public Runnable decorate (Runnable runnable) { return () -> { long t = System.currentTimeMillis(); runnable.run(); logger.info("creating ConcurrentTaskExecutor thread pool...."); System.out.printf("Thread %s has a processing time: %s%n", Thread.currentThread().getName(), (System.currentTimeMillis() - t)); }; } }); return executor; }
Example 12
Source File: SpringAsynchConfig.java From Spring-5.0-Cookbook with MIT License | 6 votes |
@Bean("mvcTaskexecutor") @Override public Executor getAsyncExecutor() { ConcurrentTaskExecutor executor = new ConcurrentTaskExecutor( Executors.newFixedThreadPool(100)); executor.setTaskDecorator(new TaskDecorator() { @Override public Runnable decorate (Runnable runnable) { return () -> { long t = System.currentTimeMillis(); runnable.run(); logger.info("creating ConcurrentTaskExecutor thread pool...."); System.out.printf("Thread %s has a processing time: %s%n", Thread.currentThread().getName(), (System.currentTimeMillis() - t)); }; } }); return executor; }
Example 13
Source File: SpringAsynchConfig.java From Spring-5.0-Cookbook with MIT License | 6 votes |
@Bean("mvcTaskexecutor") @Override public Executor getAsyncExecutor() { ConcurrentTaskExecutor executor = new ConcurrentTaskExecutor( Executors.newFixedThreadPool(100)); executor.setTaskDecorator(new TaskDecorator() { @Override public Runnable decorate (Runnable runnable) { return () -> { long t = System.currentTimeMillis(); runnable.run(); logger.info("creating ConcurrentTaskExecutor thread pool...."); System.out.printf("Thread %s has a processing time: %s%n", Thread.currentThread().getName(), (System.currentTimeMillis() - t)); }; } }); return executor; }
Example 14
Source File: BatchConfig.java From Spring-5.0-Cookbook with MIT License | 6 votes |
@Bean("mvcTaskexecutor") public TaskExecutor getAsyncExecutor() { ConcurrentTaskExecutor executor = new ConcurrentTaskExecutor( Executors.newFixedThreadPool(100)); executor.setTaskDecorator(new TaskDecorator() { @Override public Runnable decorate (Runnable runnable) { return () -> { long t = System.currentTimeMillis(); runnable.run(); System.out.printf("Thread %s has a processing time: %s%n", Thread.currentThread().getName(), (System.currentTimeMillis() - t)); }; } }); return executor; }
Example 15
Source File: SpringAsynchConfig.java From Spring-5.0-Cookbook with MIT License | 6 votes |
@Bean("mvcTaskexecutor") @Override public Executor getAsyncExecutor() { ConcurrentTaskExecutor executor = new ConcurrentTaskExecutor( Executors.newFixedThreadPool(100)); executor.setTaskDecorator(new TaskDecorator() { @Override public Runnable decorate (Runnable runnable) { return () -> { long t = System.currentTimeMillis(); runnable.run(); logger.info("creating ConcurrentTaskExecutor thread pool...."); System.out.printf("Thread %s has a processing time: %s%n", Thread.currentThread().getName(), (System.currentTimeMillis() - t)); }; } }); return executor; }