com.neeve.discovery
Interface IDiscoveryEntity


public interface IDiscoveryEntity

Represents an entity in a discovery cache.

A discovery cache contains entities discovered via the entity discovery protocol. This interface represents an entity in the cache.

Entities are immutable objects i.e. they cannot be modified once created in the cache (either explicitly or discovered). If the contents of an entity need to be changed, then the entity needs to be removed from the cache, modified and then re-added to the cache.

Threading:
This class is not safe for concurrent access by multiple threads

Method Summary
 List<UtlAddressDescriptor> getAddressDescriptors()
          Get an entity's address descriptors.
 short getAge()
          Get an entity's current age.
 IDiscoveryCache getCache()
          Get an entity's container cache.
 String getHost()
          Get the host machine on which an entity resides.
 XString getHostAsRaw()
          Get the host machine on which an entity resides in its raw (buffer backed) format.
 UUID getInstance()
          Get an entity's instance id.
 com.neeve.raw.RawUUID getInstanceAsRaw()
          Get an entity's instance id in its raw (buffer backed) format.
 short getMaxAge()
          Get an entity's maximum age.
 String getName()
          Get an entity's name.
 XString getNameAsRaw()
          Get an entity's name in its raw (buffer backed) format.
 String getOwner()
          Get an entity's owner.
 XString getOwnerAsRaw()
          Get an entity's owner in its raw (buffer backed) format.
 String getType()
          Get an entity's type.
 XString getTypeAsRaw()
          Get an entity's type in its raw (buffer backed format).
 boolean wasDiscovered()
          Get whether a cache entity was discovered or locally added.
 

Method Detail

getCache

IDiscoveryCache getCache()
Get an entity's container cache.

Threading:
This method is safe for concurrent access by multiple threads

getOwner

String getOwner()
Get an entity's owner.

Each cache entity is owned by the cache member that added the entity to the cache. This method returns the owner of a cache entity.

Threading:
This method is safe for concurrent access by multiple threads

getOwnerAsRaw

XString getOwnerAsRaw()
Get an entity's owner in its raw (buffer backed) format.

Each cache entity is owned by the cache member that added the entity to the cache. This method returns the owner of a cache entity.

Threading:
This method is safe for concurrent access by multiple threads

getType

String getType()
Get an entity's type.

Each entity in the system is categorized by a type. Entity type's are hierarchical in nature allowing for entitis to be organized using a taxonomy that is hierarchical in nature. This method returns an entity's type.

Threading:
This method is safe for concurrent access by multiple threads

getTypeAsRaw

XString getTypeAsRaw()
Get an entity's type in its raw (buffer backed format).

Each entity in the system is categorized by a type. Entity type's are hierarchical in nature allowing for entitis to be organized using a taxonomy that is hierarchical in nature. This method returns an entity's type.

Threading:
This method is safe for concurrent access by multiple threads

getName

String getName()
Get an entity's name.

Each entity in the system is uniquely identified within its type. The name is hierarchical in nature allowing for the entities to be organized using a naming taxonomy that is hierachical in nature. This method returns an entity's name.

Threading:
This method is safe for concurrent access by multiple threads

getNameAsRaw

XString getNameAsRaw()
Get an entity's name in its raw (buffer backed) format.

Each entity in the system is uniquely identified within its type. The name is hierarchical in nature allowing for the entities to be organized using a naming taxonomy that is hierachical in nature. This method returns an entity's name.

Threading:
This method is safe for concurrent access by multiple threads

getHost

String getHost()
Get the host machine on which an entity resides.

This method returns the host on which an entity resides. The discovery cache runtime uses InetAddress.getLocalHost().getHostName to determine an entity's host.

Threading:
This method is safe for concurrent access by multiple threads

getHostAsRaw

XString getHostAsRaw()
Get the host machine on which an entity resides in its raw (buffer backed) format.

This method returns the host on which an entity resides. The discovery cache runtime uses InetAddress.getLocalHost().getHostName to determine an entity's host.

Threading:
This method is safe for concurrent access by multiple threads

getInstance

UUID getInstance()
Get an entity's instance id.

Each cache entity is uniquely identified by its instance (a UUID assigned to the entity at time of creation). The purpose of the instance is to distinguish between two entities with the same type and name. When the user invokes IDiscoveryCache.add(com.neeve.discovery.IDiscoveryEntity) with the type and name of an existing entity, the existing entity is removed and a new entity object with a different instance is placed in the cache. This enables an entity to be migrated across cache members.

Threading:
This method is safe for concurrent access by multiple threads

getInstanceAsRaw

com.neeve.raw.RawUUID getInstanceAsRaw()
Get an entity's instance id in its raw (buffer backed) format.

Each cache entity is uniquely identified by its instance (a UUID assigned to the entity at time of creation). The purpose of the instance is to distinguish between two entities with the same type and name. When the user invokes IDiscoveryCache.add(com.neeve.discovery.IDiscoveryEntity) with the type and name of an existing entity, the existing entity is removed and a new entity object with a different instance is placed in the cache. This enables an entity to be migrated across cache members.

Threading:
This method is safe for concurrent access by multiple threads

getMaxAge

short getMaxAge()
Get an entity's maximum age.

Each entity instance is associated with a maximum age and, at any point in time, a current age. A cache member 'expires' (removes from its local cache) a discovered entity when its current age reaches its maximum age. To prevent entity expiry, member owners periodically broadcast ESA (Entity State Advertisement) packets. The receipt of a ESA by non-owner causes the entity's age to be reset.

An entity's maximum age is also used (in conjunction with other configurable parameters) by owner members to determine when to send ESAs.

This method returns an entity's maximum age

Threading:
This method is safe for concurrent access by multiple threads

getAge

short getAge()
Get an entity's current age.

See getMaxAge() for information on the role played by an entity's age in its lifecyle management.

This method returns an entity's current age.

Threading:
This method is safe for concurrent access by multiple threads

wasDiscovered

boolean wasDiscovered()
Get whether a cache entity was discovered or locally added.

This method will return true if and only if the entity's owner is the same as the name of the local cache member.

Threading:
This method is safe for concurrent access by multiple threads

getAddressDescriptors

List<UtlAddressDescriptor> getAddressDescriptors()
Get an entity's address descriptors.

This method returns an entity's address descriptors. The address descriptors describe how the entity can be contacted. The descriptors are returned in a list in order of priority in which the entity would like to be contacted.

Threading:
This method is safe for concurrent access by multiple threads


Copyright © 2016 Neeve Research, LLC. All Rights Reserved.