Code: Select all
spring.task.execution.pool.core-size=10
spring.task.execution.pool.max-size=20
spring.task.execution.pool.queue-capacity=50
spring.task.exection.thread-name-prefix=AsyncThread-
spring.task.exection.shutdown.await-termination=true
spring.task.exection.shutdown.await-termination-period=300s
MyExecutor {
@Async
void execute(List list){
//processing my data as list here
}
}
// class where I need to check currently running and available thread for given pool and then decide to break my list accordingly to available threads in pool.
Main {
public static void main(String[] args) {
//list having 10K objects
List data;
int currentlyAvailableThread;
int maxAllowedListSize = data.size() / currentlyAvailableThread;
// execute logic for sublist ,
}
}