So überprüfen Sie den aktuell ausgeführten Thread unter gegebenem Task -Executor mit Spring @AsyncJava

Java-Forum
Anonymous
 So überprüfen Sie den aktuell ausgeführten Thread unter gegebenem Task -Executor mit Spring @Async

Post by Anonymous »

Ich erstelle keine Bohne explizit. Ich verwende @enableAsync und Spring -Eigenschaften.

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 ,
}

}

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post