Package org.infinispan.util.concurrent
Class SynchronizedRestarter
- java.lang.Object
-
- org.infinispan.util.concurrent.SynchronizedRestarter
-
public class SynchronizedRestarter extends java.lang.Object
A class that handles restarts of components via multiple threads. Specifically, if a component needs to be restarted and several threads may demand a restart but only one thread should be allowed to restart the component, then use this class. What this class guarantees is that several threads may come in while a component is being restarted, but they will block until the restart is complete. This is different from other techniques in that:- A simple compare-and-swap to check whether another thread is already performing a restart will result in the requesting thread returning immediately and potentially attempting to use the resource being restarted.
- A synchronized method or use of a lock would result in the thread waiting for the restart to complete, but on completion will attempt to restart the component again.
- Since:
- 4.0
- Author:
- Manik Surtani
-
-
Constructor Summary
Constructors Constructor Description SynchronizedRestarter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
restartComponent(Lifecycle component)
-
-
-
Method Detail
-
restartComponent
public void restartComponent(Lifecycle component) throws java.lang.Exception
- Throws:
java.lang.Exception
-
-