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<com.neeve.util.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.
 com.neeve.raw.RawString 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.
 com.neeve.raw.RawString getNameAsRaw()
          Get an entity's name in its raw (buffer backed) format.
 String getOwner()
          Get an entity's owner.
 com.neeve.raw.RawString getOwnerAsRaw()
          Get an entity's owner in its raw (buffer backed) format.
 String getType()
          Get an entity's type.
 com.neeve.raw.RawString 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.

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

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.


getOwnerAsRaw

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

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

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.


getType

String getType()
Get an entity's type.

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

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.


getTypeAsRaw

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

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

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.


getName

String getName()
Get an entity's name.

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

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.


getNameAsRaw

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

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

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.


getHost

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

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

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


getHostAsRaw

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

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

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


getInstance

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

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

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(java.lang.String, java.lang.String, java.util.List) 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.


getInstanceAsRaw

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

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

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(java.lang.String, java.lang.String, java.util.List) 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.


getMaxAge

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

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

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


getAge

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

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

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.


wasDiscovered

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

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

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


getAddressDescriptors

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

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

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.



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