JeeWiz Home

 
  
 
Contents  >   7.  GigaSystemBuilder Profile Reference
 


7.27 SpaceHashMap Object

Used on
class
javaBean
service
DescriptionThis is a space-based implementation of java.util.HashMap. It automatically fails over to a backup space, so it is ideal for implementing resilient services on GigaSpaces.

It supports all the API methods of a standard HashMap, operating as an object outside the space. On the primary, there will be a working instance of the HashMap, plus the equivalent space entries. However, the point is that, when you make changes to the HashMap, entries are written to the space. In other words, if you put a new MapEntry object into the map, an entry is made in the space; when you remove an item (e.g. via remove()), the corresponding entry is removed from the space. This means that the complete state of the map is recorded in the space.

There must be a space for the SpaceHashMap to write the entries to. You can define the target space by making it a child of

    • a service; then the SpaceHashMap 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 SpaceHashMap 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 HashMap will not be operational - its map 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 HashMap object is automatically re-created on the new primary PU. The HashMap will continuing operating on the backup with no change to the state of the map.

The SpaceHashMap must have a name, which should be unique across the space. (Why? The HashMap uses an underlying class - the MapEntry - to write to the space. To avoid proliferation of Java classes, this is a generic class, so it needs a map name to distinguish entries in the space
    • the template class is not enough.)
The only method the SpaceHashMap does not support is clone(), for obvious reasons.

The field that holds the SpaceHashMap marked with 'inSpace' as false, which means the SpaceHashMap object is never put into the space.
Inherited
properties
template (base property)

jwpattern (base property)

 7.27.1  Property 'description'
 7.27.2  Property 'keyType'
 7.27.3  Property 'name'
 7.27.4  Property 'space'
 7.27.5  Property 'static'
 7.27.6  Property 'text'
 7.27.7  Property 'valueType'

7.27.1  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

7.27.2  Property 'keyType'
DescriptionThis is the type of the SpaceHashMap key.
TypeString
Requiredtrue

7.27.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

7.27.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

7.27.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

7.27.6  Property 'text'
TypeString

7.27.7  Property 'valueType'
DescriptionThis is the type of the values put into the SpaceHashMap.
TypeString
Requiredtrue

Copyright (c) 2001-2009 New Technology/enterprise Ltd.