com.neeve.link
Class LnkLTPAuthority

java.lang.Object
  extended by com.neeve.root.RootObject
      extended by com.neeve.link.LnkObject
          extended by com.neeve.link.LnkLTPAuthority

public final class LnkLTPAuthority
extends LnkObject

Allocates LTPs for link tree endpoints.

The LTP authority hands out LTPs to nodes (endpoints) in link trees. The authority manages static and dynamic LTPs. Static LTPs are configured in the '/ltps' simple entity container in the configuration repository. Dynamic LTPs are handed out from the set of non-static LTPs. The maximum number of LTPs that can be allocated in a Neeve application is set by MAX_LTP.

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

Field Summary
static short MAX_LTP
          Largest LTP that can be allocated by any link tree node.
 
Method Summary
 short alloc()
          Allocate an LTP.
static LnkLTPAuthority getInstance()
          Return the singleton link LTP authority instance
 short getStatic(String name)
          Get a static LTP by name.
 void release(short ltp)
          Release an LTP.
 
Methods inherited from class com.neeve.root.RootObject
getChecked, getThreaded, getTracer, setChecked, setTracer
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_LTP

public static final short MAX_LTP
Largest LTP that can be allocated by any link tree node.

This constant specifies the largest LTP that can be allocated by any link tree node in a Neeve application i.e. the maximum number of link tree nodes across all link trees is a Neeve application is equal to this constant plus 1.

See Also:
Constant Field Values
Method Detail

getInstance

public static LnkLTPAuthority getInstance()
Return the singleton link LTP authority instance

Returns:
Returns the link LTP authority .
Threading:
This method is safe for concurrent access by multiple threads

alloc

public final short alloc()
                  throws ELnkNoMoreLTPException
Allocate an LTP.

Throws:
ELnkNoMoreLTPException - Thrown in case all LTPs have already been allocated.

This method allocates an unused LTP. A value of 0 is reserved for base link peer endpoints. So, we return a value between 1 and MAX_LTP

See Also:
release(short)
Threading:
This method is safe for concurrent access by multiple threads.

getStatic

public final short getStatic(String name)
                      throws ELnkInvalidStaticLTPException
Get a static LTP by name.

Parameters:
name - The name of the static LTP.
Throws:
ELnkInvalidStaticLTPException - Thrown if the static LTP name was not found in the static LTP table.

This method is used to query a static LTP. The caller provides the name of the static LTP i.e. the name of the entity that configures the static LTP as input and receives the LTP value in return. The method throws an exception if an invalid static LTP name is specified.

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

release

public final void release(short ltp)
Release an LTP.

This method releases a previously allocated LTP by alloc().

See Also:
alloc()
Threading:
This method is safe for concurrent access by multiple threads.


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