Interface ConvergenceNameSessionOwnershipRecord
-
public interface ConvergenceNameSessionOwnershipRecord
The
ConvergenceNameSessionOwnershipRecord
interface represents a Rhino-managed session ownership record that is related to an SBB entity tree. Rhino will manage this session ownership record using the Session Ownership Facility on behalf of the SBB Entity Tree. This means that applications do not need to create, update, or store the record directly themselves, they simply ask for the record and modify attributes on it in a CMP-style fashion as desired. Modifications to the underlying record will be stored automatically by Rhino during transaction commit. The record will be automatically deleted when the SBB entity tree is removed.A convergence name session ownership record may be obtained by application code using
RhinoSbbContext.getConvergenceNameSessionOwnershipRecord()
orSbbPartContext.getConvergenceNameSessionOwnershipRecord()
.Record Continuity
Rhino will use the TTL of a convergence name session ownership record to determine if and when a record needs refreshing to ensure its continued survival for the lifetime of the SBB entity. However, such checks are only made after an SBB entity tree processes an event. This means that an application should set the TTL of this record to a value greater than the maximum expected time between received events.Attributes
The methods in this interface that provide a means to access and modify attributes on the session ownership record operate on a subset of the real session ownership attributes specifically for application use. An application can only read, modify, or remove attributes that it creates. Other attributes, such as those set by Rhino for managing the record, are not visible to applications using this interface.- Since:
- Rhino 2.6.1
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String
getAttribute(String name)
Get the value of the specified application-defined attribute from the record.Map<String,String>
getAttributes()
Get a map of all application-defined attributes and their values in the record.ConvergenceName
getConvergenceName()
Get the convergence name of the SBB entity tree that this session ownership record was created for.int
getPartitionKey()
Get the partition key of the SBB entity tree that this session ownership record was created for.String
getPrimaryKey()
Get the primary key of this session ownership record.long
getTimeToLive()
Get the current time-to-live (TTL) period for the underlying session ownership record.boolean
removeAttribute(String name)
Remove an application-defined attribute.void
setAttribute(String name, String value)
Set an application-defined attribute on the record.void
setAttributes(Map<String,String> attributes, boolean exclusive)
Set application-defined attributes on the record.void
setTimeToLive(int ttl)
Set a new time-to-live (TTL) period for the underlying session ownership record.
-
-
-
Method Detail
-
getPrimaryKey
String getPrimaryKey()
Get the primary key of this session ownership record.
- Returns:
- the primary key.
- Since:
- Rhino 2.6.1
-
getConvergenceName
ConvergenceName getConvergenceName()
Get the convergence name of the SBB entity tree that this session ownership record was created for.
- Returns:
- the convergence name.
- Since:
- Rhino 2.6.1
-
getPartitionKey
int getPartitionKey()
Get the partition key of the SBB entity tree that this session ownership record was created for.
The partition key is a session-related hash that can be used by a key/value store, for example, to aggregate related state.
- Returns:
- the partition key.
- Since:
- Rhino 3.0.0
-
getAttributes
Map<String,String> getAttributes()
Get a map of all application-defined attributes and their values in the record.
Modifications to the map returned from this method have no effect on the record the map was returned from.
- Returns:
- the name to value mappings of all current application-defined attributes.
- Since:
- Rhino 2.6.1
-
getAttribute
String getAttribute(String name)
Get the value of the specified application-defined attribute from the record.
- Parameters:
name
- the attribute name.- Returns:
- the attribute value, or
null
if no such attribute exists. - Since:
- Rhino 2.6.1
-
setAttributes
void setAttributes(Map<String,String> attributes, boolean exclusive) throws NullPointerException
Set application-defined attributes on the record.
If
exclusive
istrue
, then current set of application-defined attributes in the record will be removed and replaced by the map of attributes provided. Ifexclusive
is `false, then the specified map of attributes will be set in the record, but any existing attributes in the record that do not occur in the specified map will be left untouched.- Parameters:
attributes
- the application-defined attributes to set.exclusive
- determines if existing attributes are deleted and replaced (true
) or a union updates occurs (false
).- Throws:
NullPointerException
- ifattributes
contains null keys or values.- Since:
- Rhino 2.6.1
-
setAttribute
void setAttribute(String name, String value) throws NullPointerException
Set an application-defined attribute on the record.
- Parameters:
name
- the name of the attribute.value
- the attribute’s value.- Throws:
NullPointerException
- if either argument isnull
.- Since:
- Rhino 2.6.1
-
removeAttribute
boolean removeAttribute(String name)
Remove an application-defined attribute.
- Parameters:
name
- the name of the attribute.- Returns:
true
if the attribute was removed,false
if an attribute with the specified name did not exist.- Since:
- Rhino 2.6.1
-
getTimeToLive
long getTimeToLive()
Get the current time-to-live (TTL) period for the underlying session ownership record.
- Returns:
- the current time-to-live period, in milliseconds.
- Since:
- Rhino 2.6.1
-
setTimeToLive
void setTimeToLive(int ttl) throws IllegalArgumentException
Set a new time-to-live (TTL) period for the underlying session ownership record.
Changing the TTL period affects when Rhino may automatically refresh the underlying record to ensure its continued survival.
- Parameters:
ttl
- the minimum duration, in milliseconds, for which the session ownership record should be kept, provided the corresponding SBB entity tree is not removed.- Throws:
IllegalArgumentException
- ifttl
is not a positive number.- Since:
- Rhino 2.6.1
-
-