mirror of
				https://github.com/TeamPiped/Piped-Backend.git
				synced 2024-08-14 23:51:41 +00:00 
			
		
		
		
	Revert to using a regular cached executor.
This commit is contained in:
		
							parent
							
								
									a56b13d290
								
							
						
					
					
						commit
						7b2ac41879
					
				
					 1 changed files with 4 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -1,13 +1,13 @@
 | 
			
		|||
package me.kavin.piped.utils;
 | 
			
		||||
 | 
			
		||||
import java.util.concurrent.CompletableFuture;
 | 
			
		||||
import java.util.concurrent.ExecutorService;
 | 
			
		||||
import java.util.concurrent.Executors;
 | 
			
		||||
import java.util.concurrent.Future;
 | 
			
		||||
import java.util.function.Supplier;
 | 
			
		||||
 | 
			
		||||
public class Multithreading {
 | 
			
		||||
 | 
			
		||||
    private static final ExecutorService es = Executors.newVirtualThreadPerTaskExecutor();
 | 
			
		||||
    private static final ExecutorService es = Executors.newCachedThreadPool();
 | 
			
		||||
    private static final ExecutorService esLimited = Executors
 | 
			
		||||
            .newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 8);
 | 
			
		||||
    private static final ExecutorService esLimitedPubSub = Executors
 | 
			
		||||
| 
						 | 
				
			
			@ -29,7 +29,7 @@ public class Multithreading {
 | 
			
		|||
        return es;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static <U> CompletableFuture<U> supplyAsync(Supplier<U> supplier) {
 | 
			
		||||
        return CompletableFuture.supplyAsync(supplier, es);
 | 
			
		||||
    public static <U> Future<U> supplyAsync(Supplier<U> supplier) {
 | 
			
		||||
        return es.submit(supplier::get);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue