7.26 SpaceDelayQueue Object
| Used on |
|
| Description | This is a space-based implementation of java.util.concurrent.DelayQueue.
It automatically fails over to a backup, so it is ideal for implementing resilient services on GigaSpaces.
It supports all the API methods of a standard DelayQueue, operating as an object outside the space.
On the primary, there will be a working instance of the DelayQueue, plus the equivalent space entries.
However, the point is that, when you make changes to the DelayQueue, entries are written to the space.
In other words, if you put a new 'Delayed' object onto the queue, an entry is made in the space;
when you remove an item from the queue (via poll, take etc.), the corresponding entry is removed from the space.
This means that the complete state of the queue is recorded in the space.
There must be a space for the SpaceDelayQueue to write the entries to.
You can define the target space by making it a child of
- a service; then the SpaceDelayQueue uses the same space as the service to write entries to
- a Java Class or JavaBean which is a child of a PU with exactly one space; then the SpaceDelayQueue uses that space.
If neither of these cases apply, then you have to set the 'space' property because GigaSystemBuilder cannot deduce it.
The variable defined by this statement will be automatically instantiated;
that is why there is no default.
Naturally, the object will have no entries when instantiated - instantiation is done at PU startup time.
On the backup PU, the DelayQueue will not be operational - its queue will not be populated,
but the space will get copies of the entries from the primary.
When a failover occurs - a backup PU becomes primary - the state of the base DelayQueue object
is automatically re-created on the new primary PU.
The DelayQueue will continuing operating on the backup with no change to the order that the queue is serviced in -
although naturally the timing will be different because of the failover delay.
The SpaceDelayQueue must have a map name, which should be unique across the space.
(Why? The DelayQueue uses an underlying class - the SpaceDelayedEntry - to write to the space.
To avoid proliferation of Java classes, this is a generic class, so it needs a queue name to distinguish entries in the space
- the template class is not enough.)
The only method the SpaceDelayQueue does not support is clone(), for obvious reasons.
|
Inherited properties |
| template |
(base property)
| |
| jwpattern |
(base property)
| |
|
7.26.1 Property 'delayedType'
|
| Description | This is the type of the class that implements Delayed.
|
| Type | String |
| Required | true |
7.26.2 Property 'description'
|
| Description | A way for the modeller to enter information that can be rendered as documentation/instructions for the programmer or the end user.
|
| Type | String |
7.26.3 Property 'name'
|
| Description | The name of the modelling element (class, property etc.). This must be unique across collections of this type within the space (e.g. of all the SpaceHashMaps within its target space).
|
| Type | String |
| Required | true |
7.26.4 Property 'space'
|
| Description | The space this collection is backed up to. This is not required if the collection is a child of a service, or it is defined in a class in a PU which has precisely one service.
|
| Type | String |
7.26.5 Property 'static'
|
| Description | This is the 'static' modifier - just like the Java language 'static'.
If set to true, it makes the space collection a class member rather than an instance member.
|
| Type | boolean |
| Default | false |
7.26.6 Property 'text'
|
|