## org.apache.axis.ime.internal.util
Interface KeyedBuffer

All Known Implementing Classes:
  NonPersistentKeyedBuffer

public interface KeyedBuffer

A KeyedBuffer is a low level hybrid FIFO Queue and Keyed map Each MessageExchange implementation will create at least two KeyedBuffer's, one for messages being sent, and another for messages that have been received. KeyedBuffers differ from traditional FIFO Queues in that elements put in are keyed and can be taken out of order. Different implementations may allow for variations on how the KeyedBuffer model is implemented. For instance, the code will ship with a NonPersistentKeyedBuffer that will store all contained objects in memory. The fact that everything is stored in memory means that the buffer is not fault tolerant. If fault tolerance is required, then a Persistent KeyedBuffer must be created that persists the objects somehow.

Author:
  James M Snell (jasnell@us.ibm.com)

Method Summary
`java.lang.Object` `cancel(java.lang.Object key)` Cancel a message that has been put on the channel.
`java.lang.Object` `get()` Select and remove the next object in the buffer (does not wait for a message to be put into the buffer)
`java.lang.Object` `get(java.lang.Object key)` Select and remove the specified object in the buffer (does not wait for a message to be put into the buffer)
`java.lang.Object` `peek()` Select, but do not remove the next message on the channel.
`java.lang.Object[]` `peekAll()` Select, but do not remove all messages on the channel.
`void` `put(java.lang.Object key, java.lang.Object context)` Put a message onto the channel
`java.lang.Object` `select()` Select and remove the next message in the channel If a message is not available, wait indefinitely for one
`java.lang.Object` `select(long timeout)` Select and remove the next message in the channel If a message is not available, wait the specified amount of time for one
`java.lang.Object` `select(java.lang.Object key)` Select and remove a specific message in the channel If the message is not available, wait indefinitely for one to be available
`java.lang.Object` `select(java.lang.Object key, long timeout)` Select and remove a specific message in the channel If the message is not available, wait the specified amount of time for one
`java.lang.Object[]` `selectAll()` Select and remove all of the messages currently in the channel (useful for bulk operations).

Method Detail

### peek

    public java.lang.Object peek()

  Select, but do not remove the next message on the channel. If one does not exist, return null

### peekAll

    public java.lang.Object[] peekAll()

  Select, but do not remove all messages on the channel. This method will not block.

### put

    public void put(java.lang.Object key,
                    java.lang.Object context)

  Put a message onto the channel

### cancel

    public java.lang.Object cancel(java.lang.Object key)

  Cancel a message that has been put on the channel. Unlike select(Object key), this method will not block and wait for a message with the specified key to be put onto the MessageChannel.

### selectAll

    public java.lang.Object[] selectAll()

  Select and remove all of the messages currently in the channel (useful for bulk operations). This method will not block. It is also not guaranteed that the Channel will be empty once this operation returns (it is possible that another thread may put new MessageContexts into the channel before this operation completes)

### select

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

  Select and remove the next message in the channel If a message is not available, wait indefinitely for one

    `java.lang.InterruptedException`

### select

    public java.lang.Object select(long timeout)
                            throws java.lang.InterruptedException

  Select and remove the next message in the channel If a message is not available, wait the specified amount of time for one

    `java.lang.InterruptedException`

### select

    public java.lang.Object select(java.lang.Object key)
                            throws java.lang.InterruptedException

  Select and remove a specific message in the channel If the message is not available, wait indefinitely for one to be available

    `java.lang.InterruptedException`

### select

    public java.lang.Object select(java.lang.Object key,
                                   long timeout)
                            throws java.lang.InterruptedException

  Select and remove a specific message in the channel If the message is not available, wait the specified amount of time for one

    `java.lang.InterruptedException`

### get

    public java.lang.Object get()

  Select and remove the next object in the buffer (does not wait for a message to be put into the buffer)

### get

    public java.lang.Object get(java.lang.Object key)

  Select and remove the specified object in the buffer (does not wait for a message to be put into the buffer)

Copyright © 2003 Apache Web Services Project. All Rights Reserved.