import org.redisson.Redisson;
import org.redisson.api.RLock;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@Component
@EnableScheduling
public class MyExecutors{
private static final Logger log = LoggerFactory.getLogger(MyExecutors.class);
public void execute() {
ExecutorService t = Executors.newCachedThreadPool();
try {
while(true){
List<SupplierExecuteEvaluationOrder> list = null;
if (list == null || list.size() < 1){
return;
}
CountDownLatch countDownLatch = new CountDownLatch(list.size());
list.stream().forEach(l -> {
t.execute(new Runnable() {
@Override
public void run() {
try{
}catch (Exception e) {
}finally {
countDownLatch.countDown();
}
}
});
});
countDownLatch.await();
}
} catch (Exception e) {
} finally {
t.shutdown();
}
}
}