Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.portal.common.concurrent
Class Valve

    java.lang.Object
      org.jboss.portal.common.concurrent.Valve

    public class Valve

extends java.lang.Object

Start in closed mode and adds an open() method to keep the same valve.

Version:
  $Revision: 5451 $
Author:
  Adrian Brock, Julien Viet

Field Summary
`static int` | `CLOSED` The valve is in hold state.
`static int` | `CLOSING` The valve is in holding state.
`protected int` | `invocations` The invocation count.
`static int` | `OPEN` The valve is open.
`protected int` | `state` The state.
`protected java.lang.Object` | `stateLock` The state lock.

Constructor Summary
`` | `Valve()` Create a valve in the closed state
`protected` | `Valve(int state)` Create a valve with the give initial state

Method Summary
`void` | `afterInvocation()` Invoked after an invocation
`boolean` | `beforeInvocation()` Invoked before an invocation
`void` | `closed()` Invoked after closing.
`void` | `closing()` Invoked before closing.
`boolean` | `closing(long millis)` Invoked before closing.
`int` | `getInvocations()` How many invocations are held in the valve.
`int` | `getState()` Return the state.
`boolean` | `isClosed()` Are we closed?
`void` | `open()` Open the valve.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### OPEN

    public static final int OPEN

  The valve is open.

  See Also:
    Constant Field Values

### CLOSING

    public static final int CLOSING

  The valve is in holding state.

  See Also:
    Constant Field Values

### CLOSED

    public static final int CLOSED

  The valve is in hold state.

  See Also:
    Constant Field Values

### stateLock

    protected final java.lang.Object stateLock

  The state lock.

### state

    protected int state

  The state.

### invocations

    protected int invocations

  The invocation count.

Constructor Detail

### Valve

    public Valve()

  Create a valve in the closed state

### Valve

    protected Valve(int state)

  Create a valve with the give initial state

  Parameters:
    `state` - the initial state

Method Detail

### isClosed

    public boolean isClosed()

  Are we closed?

  Returns:
    true when closing or closed, false otherwise

### beforeInvocation

    public boolean beforeInvocation()

  Invoked before an invocation

  Returns:
    true if allowed entry, false otherwise

### afterInvocation

    public void afterInvocation()

  Invoked after an invocation

### getState

    public int getState()

  Return the state.

### getInvocations

    public int getInvocations()

  How many invocations are held in the valve.

### open

    public void open()
              throws java.lang.IllegalStateException

  Open the valve.

  Throws:
    `java.lang.IllegalStateException` - if the valve is not closed

### closing

    public void closing()
                 throws java.lang.IllegalStateException

  Invoked before closing.

  Throws:
    `java.lang.IllegalStateException` - if the valve is closed

### closing

    public boolean closing(long millis)
                    throws java.lang.IllegalStateException

  Invoked before closing.

  Throws:
    `java.lang.IllegalStateException` - if the valve is closed

### closed

    public void closed()
                throws java.lang.IllegalStateException

  Invoked after closing.

  Throws:
    `java.lang.IllegalStateException` - if the valve is not closing

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008. All Rights Reserved.