com.softwareag.um.storage.StorageProperties Class Reference

Contains the properties used to construct a Storage object. More...

Public Member Functions

int getBufferSize ()
 
int getCapacity ()
 See setCapacity for a full description of this attribute. More...
 
EventFactory getEventFactory ()
 
int getEventsBeforeSync ()
 
long getMinFileSizeBeforeAutoMaintenance ()
 
int getPercentFree ()
 
String getStoreName ()
 
StorageSyncListener getSyncListener ()
 
int getTimeBetweenSync ()
 
long getTTL ()
 
StorageType getType ()
 
boolean isBufferReads ()
 
boolean isCacheDuringReload ()
 
boolean isPerformAutoMaintenance ()
 
boolean isSyncOnWrite ()
 
void setBufferReads (boolean bufferReads)
 To optimise the reading from disks the store can be configured to read large buffers of the file into memory and process it directly, rather than individual reads from a file. More...
 
void setBufferSize (int bufferSize)
 This sets the size of the buffer used to read ahead when reading from file, used by StorageType.Mixed and StorageType.Persistent. More...
 
void setCacheDuringReload (boolean cacheDuringReload)
 If set then when the store is reloaded, events will be placed into a memory that otherwise would remain on disk. More...
 
void setCacheEvents (boolean cacheEvents)
 If the CacheEvents is set to true, then when writing or reloading events the store will cache the event in memory on the chance that the event maybe required again. More...
 
void setCapacity (int capacity)
 Sets the maximum number of events that the store will hold. More...
 
void setEventFactory (EventFactory eventFactory)
 Sets the EventFactory to use for event serialisation. More...
 
void setEventsBeforeSync (int eventsBeforeSync)
 Sets the maximum number of events before sync() is called on the file system. More...
 
void setPercentFree (int percentFree)
 Set the percent free threshold. More...
 
void setStoreName (String storeName)
 Sets the name of the store. More...
 
void setSyncListener (StorageSyncListener listener)
 Set a sync listener to be called whenever the stores lower levels calls the file descriptors sync() function. More...
 
void setSyncOnWrite (boolean syncOnWrite)
 If syncOnWrite set, then for every write to the store the underlying file system is synced to ensure all data is flushed through the OS cache. More...
 
void setTimeBetweenSync (int timeBetweenSync)
 Sets the maximum time between when an event is written and sync is called. More...
 
void setTTL (long ttl)
 Sets the Time To Live for the store in milliseconds. More...
 
void setType (StorageType type)
 Sets the StorageType to use for the store. More...
 
 StorageProperties (StorageType type, String storeName, EventFactory factory)
 Constructor for StorageProperties. More...
 

Static Public Member Functions

static long getMaxTimeForScheduler ()
 Returns the currently configured maximum time for the stores management run to wait between runs. More...
 
static long getMinTimeForScheduler ()
 Returns the currently configured time for the stores management run to wait between runs. More...
 
static void setMaxTimeForScheduler (long time)
 This value specifies the longest amount of time, in milliseconds, that the stores management tasks will wait between runs. More...
 
static void setMinFileSizeBeforeAutoMaintenance (long size)
 This sets the size of a store before an auto maintenance task is run. More...
 
static void setMinTimeForScheduler (long time)
 This value specifies the smallest amount of time, in milliseconds, that the stores management tasks will wait between runs. More...
 

Detailed Description

Contains the properties used to construct a Storage object.

Note:

If the Percent Free is non zero, then the store will automatically run Storage.performMaintenance() when the stores free space versus used space reaches this value. For example, if you specify 80, then once the free space reaches or exceeds 80% of the file, then the scheduled task will reclaim the unused space. This is only applicable to StoreType.Mixed StoreType.Persistent, the other types do not require any action to reclaim unused space.

Constructor & Destructor Documentation

com.softwareag.um.storage.StorageProperties.StorageProperties ( StorageType  type,
String  storeName,
EventFactory  factory 
)

Constructor for StorageProperties.

Parameters
typeThe StorageType that will be constructed
storeNameThe name of the store, if file based, the file name will have ".mem" appended to it
factoryThe EventFactory required to deserialise the event from a store

Member Function Documentation

int com.softwareag.um.storage.StorageProperties.getBufferSize ( )
Returns
The size of the buffer/page to use
int com.softwareag.um.storage.StorageProperties.getCapacity ( )

See setCapacity for a full description of this attribute.

Returns
The maximum number of events that the store can hold
EventFactory com.softwareag.um.storage.StorageProperties.getEventFactory ( )
Returns
The event factory to use for event serialisation
int com.softwareag.um.storage.StorageProperties.getEventsBeforeSync ( )
Returns
The number of events between sync() functions being called
static long com.softwareag.um.storage.StorageProperties.getMaxTimeForScheduler ( )
static

Returns the currently configured maximum time for the stores management run to wait between runs.

This is a static value across ALL stores

Returns
long com.softwareag.um.storage.StorageProperties.getMinFileSizeBeforeAutoMaintenance ( )
Returns
The currently configured size
static long com.softwareag.um.storage.StorageProperties.getMinTimeForScheduler ( )
static

Returns the currently configured time for the stores management run to wait between runs.

This is a static value across ALL stores

Returns
int com.softwareag.um.storage.StorageProperties.getPercentFree ( )
Returns
The current percent free
String com.softwareag.um.storage.StorageProperties.getStoreName ( )
Returns
The name of the store
StorageSyncListener com.softwareag.um.storage.StorageProperties.getSyncListener ( )
Returns
Returns the current StorageSyncListener
int com.softwareag.um.storage.StorageProperties.getTimeBetweenSync ( )
Returns
the time in milliseconds between when an event is written and sync is called
long com.softwareag.um.storage.StorageProperties.getTTL ( )
Returns
The current Time To Live for the store
StorageType com.softwareag.um.storage.StorageProperties.getType ( )
Returns
The current StorageType
boolean com.softwareag.um.storage.StorageProperties.isBufferReads ( )
Returns
If the store will buffer reads or not
boolean com.softwareag.um.storage.StorageProperties.isCacheDuringReload ( )
Returns
If the store will reload the events into memory
boolean com.softwareag.um.storage.StorageProperties.isPerformAutoMaintenance ( )
Returns
True if the configuration would cause the perform maintenance to be run automatically
boolean com.softwareag.um.storage.StorageProperties.isSyncOnWrite ( )
Returns
If the store will sync each write
void com.softwareag.um.storage.StorageProperties.setBufferReads ( boolean  bufferReads)

To optimise the reading from disks the store can be configured to read large buffers of the file into memory and process it directly, rather than individual reads from a file.

This allows the store to read ahead of the event

Parameters
bufferReads
void com.softwareag.um.storage.StorageProperties.setBufferSize ( int  bufferSize)

This sets the size of the buffer used to read ahead when reading from file, used by StorageType.Mixed and StorageType.Persistent.

When used in conjunction with StorageType.Paged it specifies the size of the pages to allocate

Parameters
bufferSize
void com.softwareag.um.storage.StorageProperties.setCacheDuringReload ( boolean  cacheDuringReload)

If set then when the store is reloaded, events will be placed into a memory that otherwise would remain on disk.

This is useful if the application needs a "fast" start to access the events. If the events are not required at application start then by setting this to false the events are not loaded reducing memory usage at load time

Parameters
cacheDuringReload
void com.softwareag.um.storage.StorageProperties.setCacheEvents ( boolean  cacheEvents)

If the CacheEvents is set to true, then when writing or reloading events the store will cache the event in memory on the chance that the event maybe required again.

This cache is routinely cleared after a certain time period

Parameters
cacheEvents
void com.softwareag.um.storage.StorageProperties.setCapacity ( int  capacity)

Sets the maximum number of events that the store will hold.

If 0 then no limit is implied and it is up to the application to manage the size of the store. Once the store exceeds this number then the lowest event ( based on the Event Key ) is removed.

Parameters
capacity
void com.softwareag.um.storage.StorageProperties.setEventFactory ( EventFactory  eventFactory)

Sets the EventFactory to use for event serialisation.

Parameters
eventFactory
void com.softwareag.um.storage.StorageProperties.setEventsBeforeSync ( int  eventsBeforeSync)

Sets the maximum number of events before sync() is called on the file system.

Parameters
eventsBeforeSync
static void com.softwareag.um.storage.StorageProperties.setMaxTimeForScheduler ( long  time)
static

This value specifies the longest amount of time, in milliseconds, that the stores management tasks will wait between runs.

This is a static value across ALL stores

Parameters
time
static void com.softwareag.um.storage.StorageProperties.setMinFileSizeBeforeAutoMaintenance ( long  size)
static

This sets the size of a store before an auto maintenance task is run.

If the file is small it results in undesired cycles of maintenance running

This is a static value across all stores

Parameters
size
static void com.softwareag.um.storage.StorageProperties.setMinTimeForScheduler ( long  time)
static

This value specifies the smallest amount of time, in milliseconds, that the stores management tasks will wait between runs.

This is a static value across ALL stores

Parameters
time
void com.softwareag.um.storage.StorageProperties.setPercentFree ( int  percentFree)

Set the percent free threshold.

Parameters
percentFree
void com.softwareag.um.storage.StorageProperties.setStoreName ( String  storeName)

Sets the name of the store.

Any directory paths required will be created during the Storage creation

Parameters
storeName
void com.softwareag.um.storage.StorageProperties.setSyncListener ( StorageSyncListener  listener)

Set a sync listener to be called whenever the stores lower levels calls the file descriptors sync() function.

Parameters
listener
void com.softwareag.um.storage.StorageProperties.setSyncOnWrite ( boolean  syncOnWrite)

If syncOnWrite set, then for every write to the store the underlying file system is synced to ensure all data is flushed through the OS cache.

This has dramatic impact on performance and should be used only if absolutely required.

Parameters
syncOnWrite
void com.softwareag.um.storage.StorageProperties.setTimeBetweenSync ( int  timeBetweenSync)

Sets the maximum time between when an event is written and sync is called.

Please note, times of less then 10ms are rounded to 10ms

Parameters
timeBetweenSync
void com.softwareag.um.storage.StorageProperties.setTTL ( long  ttl)

Sets the Time To Live for the store in milliseconds.

Once the event exceeds this time the store will automatically remove it.

Parameters
ttl
void com.softwareag.um.storage.StorageProperties.setType ( StorageType  type)

Sets the StorageType to use for the store.

Parameters
type