org.jboss.jms.client
Class FailoverValve
java.lang.Object
org.jboss.jms.client.FailoverValve
public class FailoverValve
- extends java.lang.Object
The valve will block any call as long as it is closed.
Usage: call enter() when performing a regular call and leave() in a finally block. Call close()
when performing a failover, and open() in a finally block.
The class contains logic to avoid dead locks between multiple threads closing the valve at the
same time, which uses referencing counting on a threadLocal variable. That's why it's very
important to aways leave the valve in a finally block.
This class also generate tracing information, to help debug situations like the case the valve
can't be closed, but only if trace is enabled on log4j.
- Version:
- $Revision: 3262 $
$Id: FailoverValve.java 3262 2007-10-30 09:09:55Z timfox $
- Author:
- Clebert Suconic
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
DEFAULT_ATTEMPT_TIMEOUT
public static final long DEFAULT_ATTEMPT_TIMEOUT
- See Also:
- Constant Field Values
FailoverValve
public FailoverValve()
FailoverValve
public FailoverValve(long attemptTiemout)
FailoverValve
public FailoverValve(FailoverCommandCenter fcc)
FailoverValve
public FailoverValve(FailoverCommandCenter fcc,
long attemptTiemout)
- Parameters:
fcc
- - can be null, for an uninitialized valve.
enter
public void enter()
throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
leave
public void leave()
throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
close
public void close()
throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
open
public void open()
throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
getWriteLockAttemptTimeout
public long getWriteLockAttemptTimeout()
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
Copyright © 2006 JBoss Inc. All Rights Reserved.