Class SynchronizedRestarter

  extended by org.jboss.cache.util.concurrent.SynchronizedRestarter

public class SynchronizedRestarter
extends 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:

This implementation combines a compare-and-swap to detect a concurrent restart, as well as registering for notification for when the restart completes and then parking the thread if the CAS variable still indicates a restart in progress, and finally deregistering itself in the end.

Manik Surtani

Constructor Summary
Method Summary
 void restartComponent(Lifecycle component)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public SynchronizedRestarter()
Method Detail


public void restartComponent(Lifecycle component)
                      throws Exception

Copyright © 2009 JBoss, a division of Red Hat. All Rights Reserved.