CloudTran Home

 
  
 
Contents  >   11.  CloudTran Profile Reference
 


11.35 SpaceDelayQueue Object

Used on
class
javaBean
service
DescriptionThis 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/CloudTran 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<keyType,valueType> - 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.

 11.35.1  Property 'delayedType'
 11.35.2  Property 'description'
 11.35.3  Property 'name'
 11.35.4  Property 'space'
 11.35.5  Property 'static'
 11.35.6  Property 'text'

11.35.1  Property 'delayedType'
DescriptionThis is the type of the class that implements Delayed.
TypeString
Requiredtrue

11.35.2  Property 'description'
DescriptionA way for the modeller to enter information that can be rendered as documentation/instructions for the programmer or the end user.
TypeString

11.35.3  Property 'name'
DescriptionThe 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).
TypeString
Requiredtrue

11.35.4  Property 'space'
DescriptionThe 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.
TypeString

11.35.5  Property 'static'
DescriptionThis 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.
Typeboolean
Defaultfalse

11.35.6  Property 'text'
TypeString

Copyright (c) 2001-2011 CloudTran Inc.