Public Member Functions | Static Public Attributes

cern.laser.util.buffer.SynchroBuffer Class Reference

List of all members.

Public Member Functions

 SynchroBuffer (long minWindowSize, long maxWindowSize, int windowGrowthFactor, int duplicatePolicy)
 SynchroBuffer ()
void push (Object object)
void push (Collection collection)
void setSynchroBufferListener (SynchroBufferListener listener)
void enable ()
void disable ()
void close ()

Static Public Attributes

static final int DUPLICATE_OK = 1
static final int DUPLICATE_REPLACE = 2
static final int DUPLICATE_DISCARD = 3

Detailed Description

A buffering utility class.

Author:
F.Calderini

Constructor & Destructor Documentation

cern.laser.util.buffer.SynchroBuffer.SynchroBuffer ( long  minWindowSize,
long  maxWindowSize,
int  windowGrowthFactor,
int  duplicatePolicy 
)

Constructor.

Parameters:
minWindowSize the buffer window min size (msec)
maxWindowSize the buffer window max size (msec)
windowGrowthFactor the buffer window growth factor (size = minWindowSize + msg/sec x windowGrowthFactor)
duplicatePolicy the buffer object duplication policy
cern.laser.util.buffer.SynchroBuffer.SynchroBuffer (  ) 

Default constructor. Initialisation is made via properties. It reads the configuration from the resource config file specified via the system property syncrobuffer.properties. If not defined, it looks for the default config file synchrobuffer-config.properties. System properties override the configuration loaded from the properties file. Configuration properties are :

  • synchrobuffer.minwindowsize (msec, default 500)
  • synchrobuffer.maxwindowsize (msec, default 5000)
  • synchrobuffer.windowgrowthfactor (windowSize = minWindowSize + msg/sec x windowGrowthFactor, default 100)
  • synchrobuffer.duplicatepolicy (default SynchroBuffer.DUPLICATES_OK)

Member Function Documentation

void cern.laser.util.buffer.SynchroBuffer.close (  ) 
void cern.laser.util.buffer.SynchroBuffer.disable (  ) 

Disable the listener. Pushed object are kept in the buffer and delivered when the listener is enabled.

Referenced by cern.laser.util.buffer.SynchroBufferAdapter.disable().

void cern.laser.util.buffer.SynchroBuffer.enable (  ) 
void cern.laser.util.buffer.SynchroBuffer.push ( Collection  collection  ) 

Push a collection of objects into the buffer.

Parameters:
collection the collection of objects to push

References cern.laser.util.buffer.SynchroBuffer.push().

void cern.laser.util.buffer.SynchroBuffer.push ( Object  object  ) 

Push an object into the buffer. If the duplicate policy is DUPLICATE_DISCARD the object is discarded if the buffer already contains it. If the duplicate policy is DUPLICATE_REPLACE the object replaces any previously pushed duplicated instance. The object is appended otherwise. Equals method is used to determine duplications.

Parameters:
o the object to push

Referenced by cern.laser.business.cache.AlarmCacheListenerImpl.onAlarmChange(), cern.laser.util.buffer.SynchroBufferAdapter.push(), cern.laser.util.buffer.SynchroBuffer.push(), and cern.laser.source.alarmsysteminterface.impl.AlarmSystemInterfaceProxy.push().

void cern.laser.util.buffer.SynchroBuffer.setSynchroBufferListener ( SynchroBufferListener  listener  ) 

Member Data Documentation

Discards duplicated objects.

Allows object duplication.

Replaces duplicated objects.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties