public interface

TrapMessageBuffer

com.ericsson.research.trap.spi.TrapMessageBuffer
Known Indirect Subclasses

Class Overview

A TrapMessageBuffer is a circular buffer with reordering capabilities for TrapMessage objects. Messages are inserted using put() in any random order, and accessed using fetch() in sequential order.

Summary

Public Methods
abstract int available()
Accessor for the number of objects available for reading.
abstract boolean fetch(TrapEndpointMessage target)
Fetches the next available message.
abstract void put(TrapMessage m, TrapTransport t)
Inserts a message into the buffer.

Public Methods

public abstract int available ()

Accessor for the number of objects available for reading.

Returns
  • The number of objects in the buffer at this point in time.

public abstract boolean fetch (TrapEndpointMessage target)

Fetches the next available message. For performance reasons, this method requires a target to fetch into. This is an atomic operation. The fetched object is removed from the buffer

Parameters
target The target object to fetch into. The m and t properties will be overwritten.
Returns
  • true if a message was fetched, false otherwise.

public abstract void put (TrapMessage m, TrapTransport t)

Inserts a message into the buffer. The insertion is such that it is in the correct order in the buffer as per the message ID. Multiple invocations for the same message ID are discarded silently.

Parameters
m The message to insert.
t The transport it was transported on.
Throws
IllegalArgumentException If the message doesn't fit in the buffer.