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.jasig.portal.utils
Class BlockingStack

    java.lang.Object
      org.jasig.portal.utils.BlockingStack

    public class BlockingStack

extends java.lang.Object

A simple FILO stack that has MIN/MAX capacity and that blocks if either push/pop would result in violation of these limits. Default values for min/max are 0/infinite

Author:
  Peter Kharchenko

Field Summary
`(package private) int` | `maxSize`
`(package private) int` | `minSize`
`(package private) java.util.Stack` | `stack`

Constructor Summary
`BlockingStack()`
`BlockingStack(int max)`
`BlockingStack(int min, int max)` Construct a new blocking stack with predefined max/min limits

Method Summary
`boolean` | `empty()`
`int` | `getMaxSize()`
`int` | `getMinSize()`
`java.lang.Object` | `nonBlockingPop()` Regular, non-blocking pop
`boolean` | `nonBlockingPush(java.lang.Object o)` Regular, non-blocking push.
`java.lang.Object` | `pop()` Remove object from the top of the stack
`void` | `push(java.lang.Object o)` Add new object to the top of the stack
`boolean` | `remove(java.lang.Object o)` Find and remove a specific object from the stack
`void` | `setLimits(int max, int min)` Set the stack limits.
`void` | `setMaxSize(int max)`
`void` | `setMinSize(int min)`
`int` | `size()`

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

Field Detail

### maxSize

    int maxSize

### minSize

    int minSize

### stack

    volatile java.util.Stack stack

Constructor Detail

### BlockingStack

    BlockingStack()

### BlockingStack

    BlockingStack(int min,
                  int max)

  Construct a new blocking stack with predefined max/min limits

### BlockingStack

    BlockingStack(int max)

Method Detail

### empty

    public boolean empty()

### push

    public void push(java.lang.Object o)
              throws java.lang.InterruptedException

  Add new object to the top of the stack

  Parameters:
    `o` - object to be placed on the stack
  Throws:
    `java.lang.InterruptedException`

### pop

    public java.lang.Object pop()
                         throws java.lang.InterruptedException

  Remove object from the top of the stack

  Throws:
    `java.lang.InterruptedException` - if the wait was interrupted

### nonBlockingPop

    public java.lang.Object nonBlockingPop()
                                    throws java.util.EmptyStackException

  Regular, non-blocking pop

  Throws:
    `java.util.EmptyStackException`

### nonBlockingPush

    public boolean nonBlockingPush(java.lang.Object o)

  Regular, non-blocking push.

### setLimits

    public void setLimits(int max,
                          int min)

  Set the stack limits. To specify a stack without an upper bound (that is max=inifinity) use max value of -1

### remove

    public boolean remove(java.lang.Object o)

  Find and remove a specific object from the stack

### getMaxSize

    public int getMaxSize()

### getMinSize

    public int getMinSize()

### setMaxSize

    public void setMaxSize(int max)

### setMinSize

    public void setMinSize(int min)

### size

    public int size()

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