Using interrupts, volatiles or AtomicBooleans to stop the thread and Thread.sleep or Schedulers for conditional timeouts. Channel ---------------------------------- Complex concepts explained in short & simple manner. Topics include Java Concurrency, Spring Boot, Microservices, Distributed Systems etc. Feel free to ask any doubts in the comments. Also happy to take requests for new videos. Subscribe or explore the channel - https://youtube.com/defogtech New video added every weekend. Popular Videos ---------------------------------- What is an API Gateway - https://youtu.be/vHQqQBYJtLI Executor Service - https://youtu.be/6Oo-9Can3H8 Introduction to CompletableFuture - https://youtu.be/ImtZgX1nmr8 Java Memory Model in 10 minutes - https://youtu.be/Z4hMFBvCDV4 Volatile vs Atomic - https://youtu.be/WH5UvQJizH0 What is Spring Webflux - https://youtu.be/M3jNn3HMeWg Java Concurrency Interview question - https://youtu.be/_RSAS-gIjGo