com.neeve.server.config
Class SrvConfigDescriptor

java.lang.Object
  extended by com.neeve.root.RootObject
      extended by com.neeve.daemon.config.DmnConfigDescriptor
          extended by com.neeve.server.config.SrvConfigDescriptor
All Implemented Interfaces:
IDmnConfigDescriptor

public final class SrvConfigDescriptor
extends DmnConfigDescriptor

Server configuration descriptor.

This class describes a Talon server and contains methods to persist and load descriptors to/from the platform configuration repositories.

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

Method Summary
 void addAcceptor(String descriptor)
          Add a client acceptor to the acceptor set.
 void addApp(SrvConfigAppDescriptor app)
          Add a server app to the app set.
static SrvConfigDescriptor create(String name)
          Create a default server descriptor instance.
static SrvConfigDescriptor create(com.neeve.util.UtlAddressDescriptor descriptor)
          Create a server descriptor from an address descriptor object
static SrvConfigDescriptor createFromEnvironment()
          Create a server descriptor instance initialized from the environment.
 void delete(IConfigRepository repo)
          Delete a server descriptor from a configuration repository.
 Set<String> getAcceptors()
          Get the configured list of client acceptors.
 SrvConfigAppDescriptor getApp(String appName)
          Get a server app from the app set.
 Set<String> getAppNames()
          Get the names of the configured list of server apps.
 Set<SrvConfigAppDescriptor> getApps()
          Get the configured list of server apps.
 int getClientHandshakeTimeout()
          Get the client handshake timeout.
 String getDiscoveryDescriptor()
          Gets the server's discovery descriptor.
 String getGroup()
          Implementation of IDmnConfigDescriptor.getGroup().
 int getIOThreadCount()
          Implementation of IDmnConfigDescriptor.getIOThreadCount().
 long getIOThreadCPUAffinityMask(int threadId)
          Implementation of IDmnConfigDescriptor.getIOThreadCPUAffinityMask(int).
 long[] getIOThreadCPUAffinityMasks()
          Implementation of IDmnConfigDescriptor.getIOThreadCPUAffinityMasks().
 int getMaxOnDemandThreadCount()
          Implementation of IDmnConfigDescriptor.getMaxOnDemandThreadCount().
 int getMaxTraceHistory()
          Get the maximum number of trace records to buffer in the server's trace history buffer.
 int getMemoryReservePct()
          Implementation of IDmnConfigDescriptor.getMemoryReservePct().
 String getName()
          Implementation of IDmnConfigDescriptor.getName().
 Properties getOtherProperties()
          Get all non-server properties.
 String getOtherProperty(String name)
          Get a non-server property
 short getVersion()
          Implementation of IDmnConfigDescriptor.getVersion().
 boolean isChecked()
          Implementation of IDmnConfigDescriptor.isChecked().
 boolean isMultiThreaded()
          Implementation of IDmnConfigDescriptor.isMultiThreaded().
 boolean isPrintDescriptor()
          Implementation of IDmnConfigDescriptor.isPrintDescriptor().
static SrvConfigDescriptor load(IConfigRepository repo, String name)
          Create a server descriptor from a configuration repository.
 SrvConfigDescriptor load(Properties props, boolean shortForm)
          Load descriptor from properties in a property table.
static SrvConfigDescriptor load(String name)
          Create a server descriptor from the default configuration repository.
static Set<SrvConfigDescriptor> loadAll()
          Create server descriptors for all servers configured in the default configuration repository.
static Set<SrvConfigDescriptor> loadAll(IConfigRepository repo)
          Create server descriptors for all servers in a configuration repository.
 void removeAcceptor(String descriptor)
          Remove a client acceptor from the acceptor set.
 void removeApp(String appName)
          Remove a server app from the app set.
 void save()
          Save a server descriptor to the default configuration repository.
 void save(IConfigRepository repo)
          Save a server descriptor to a configuration repository.
 Properties save(Properties props, boolean shortForm)
          Save a server descriptor to a property table.
 void setClientHandshakeTimeout(int timeout)
          Set the client handshake timeout.
 void setDiscoveryDescriptor(String discoveryDescriptor)
          Sets the server's discovery descriptor.
 void setGroup(String group)
          Implementation of IDmnConfigDescriptor.setGroup(java.lang.String).
 void setIOThreadCount(int ioThreadCount)
          Implementation of IDmnConfigDescriptor.setIOThreadCount(int).
 void setIOThreadCPUAffinityMask(int threadId, long mask)
          Implementation of IDmnConfigDescriptor.setIOThreadCPUAffinityMask(int, long).
 void setMaxOnDemandThreadCount(int maxOnDemandThreadCount)
          Implementation of IDmnConfigDescriptor.setMaxOnDemandThreadCount(int).
 void setMaxTraceHistory(int maxRecords)
          Set the maximum number of trace records to buffer in the server's trace history buffer.
 void setMemoryReservePct(int pct)
          Implementation of IDmnConfigDescriptor.setMemoryReservePct(int).
 void setMultiThreaded(boolean multiThreaded)
          Implementation of IDmnConfigDescriptor.setMultiThreaded(boolean).
 void setOtherProperty(String name, String val)
          Set a non-server property.
 void setPrintDescriptor(boolean printDescriptor)
          Implementation of IDmnConfigDescriptor.setPrintDescriptor(boolean).
 String toString()
          Return a string representation of this object
 
Methods inherited from class com.neeve.daemon.config.DmnConfigDescriptor
setTraceLevel, toString
 
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, wait, wait, wait
 
Methods inherited from interface com.neeve.daemon.config.IDmnConfigDescriptor
setChecked
 

Method Detail

getName

public final String getName()
Implementation of IDmnConfigDescriptor.getName().

Returns:
Returns the configured name of the daemon.

This method returns the configured name of this daemon. The default name of a daemon is configured using the nv.app.name property.


getVersion

public final short getVersion()
Implementation of IDmnConfigDescriptor.getVersion().

Returns:
Returns the current version of the daemon implementation.

This method returns the daemon implementation version.


setGroup

public final void setGroup(String group)
Implementation of IDmnConfigDescriptor.setGroup(java.lang.String).

Parameters:
group - The daemon's new application group.

getGroup

public final String getGroup()
Implementation of IDmnConfigDescriptor.getGroup().

Returns:
Returns the configured application group of the daemon.

This method returns the configured group of this daemon. The daemon group is configured using the nv.app.group property. The daemon group serves to partition applications into non-intersecting groups. The daemon does not allow connections from entities that are in a group different from its group.


isChecked

public final boolean isChecked()
Implementation of IDmnConfigDescriptor.isChecked().

Returns:
Returns whether the daemon is oonfigured to operated in checked or unchecked mode.

This method returns whether the daemon is configured to operated in checked mode. When operating in checked mode, the daemon performs additional state and integrity checks.


setMultiThreaded

public final void setMultiThreaded(boolean multiThreaded)
Implementation of IDmnConfigDescriptor.setMultiThreaded(boolean).

Parameters:
multiThreaded - Boolean value indicating whether the daemon should operate in single or multi threaded mode.

isMultiThreaded

public final boolean isMultiThreaded()
Implementation of IDmnConfigDescriptor.isMultiThreaded().

Returns:
Returns whether the daemon is oonfigured to operated in single or multi threaded mode.

This method returns whether the daemon is configured to operate in multi-threaded mode.


setPrintDescriptor

public final void setPrintDescriptor(boolean printDescriptor)
Implementation of IDmnConfigDescriptor.setPrintDescriptor(boolean).

Parameters:
printDescriptor - Boolean value indicating whether the daemon should print its descriptor on startup or not.

isPrintDescriptor

public final boolean isPrintDescriptor()
Implementation of IDmnConfigDescriptor.isPrintDescriptor().

Returns:
Returns whether the daemon is configured to print its descriptor object on startup

This method returns whether the daemon is configured to print its descriptor object on startup. If true, the daemon will print its descriptor to System.out.


setIOThreadCount

public final void setIOThreadCount(int ioThreadCount)
Implementation of IDmnConfigDescriptor.setIOThreadCount(int).

Parameters:
ioThreadCount - The number of I/O threads to start.

getIOThreadCount

public final int getIOThreadCount()
Implementation of IDmnConfigDescriptor.getIOThreadCount().

Returns:
Returns the daemon I/O thread count.

This method returns the number of I/O threads to start in the daemon.


setIOThreadCPUAffinityMask

public final void setIOThreadCPUAffinityMask(int threadId,
                                             long mask)
Implementation of IDmnConfigDescriptor.setIOThreadCPUAffinityMask(int, long).

Parameters:
threadId - The IO thread id - 0 <= id < ioThreadCount
mask - The affinity mask to set.

getIOThreadCPUAffinityMask

public final long getIOThreadCPUAffinityMask(int threadId)
Implementation of IDmnConfigDescriptor.getIOThreadCPUAffinityMask(int).

Parameters:
threadId - The IO thread id - 0 <= id < ioThreadCount

getIOThreadCPUAffinityMasks

public final long[] getIOThreadCPUAffinityMasks()
Implementation of IDmnConfigDescriptor.getIOThreadCPUAffinityMasks().

Returns:
Returns the array of CPU affinities. The length of the returned array is equal to the number of IO threads configured in the system.

setMaxOnDemandThreadCount

public final void setMaxOnDemandThreadCount(int maxOnDemandThreadCount)
Implementation of IDmnConfigDescriptor.setMaxOnDemandThreadCount(int).

Parameters:
maxOnDemandThreadCount - The max number of on-demand threads that can be created.

getMaxOnDemandThreadCount

public final int getMaxOnDemandThreadCount()
Implementation of IDmnConfigDescriptor.getMaxOnDemandThreadCount().

Returns:
Returns the maxmimum on-demand thread count.

This method returns the maximum number of on-demand threads that can be created in the daemon. A value of -1 indicates an unlimited number of threads can be created.


setMemoryReservePct

public final void setMemoryReservePct(int pct)
Implementation of IDmnConfigDescriptor.setMemoryReservePct(int).

Parameters:
pct - Percentage of total memory to reserve

getMemoryReservePct

public final int getMemoryReservePct()
Implementation of IDmnConfigDescriptor.getMemoryReservePct().


setMaxTraceHistory

public final void setMaxTraceHistory(int maxRecords)
Set the maximum number of trace records to buffer in the server's trace history buffer.

Parameters:
maxRecords - The maximum number of trace records.
Threading:
This method is safe for concurrent access by multiple threads.

getMaxTraceHistory

public final int getMaxTraceHistory()
Get the maximum number of trace records to buffer in the server's trace history buffer.

Returns:
Returns the max trace history.
Threading:
This method is safe for concurrent access by multiple threads.

setDiscoveryDescriptor

public void setDiscoveryDescriptor(String discoveryDescriptor)
Sets the server's discovery descriptor. Setting this value to null will cause the server to use the default discovery returned by the DiscoveryFactory which would typically be configured via the XRuntime environment' nv.discovery.descriptor value

Parameters:
discoveryDescriptor - The discovery descriptor.
Threading:
This method is safe for concurrent access by multiple threads.

getDiscoveryDescriptor

public String getDiscoveryDescriptor()
Gets the server's discovery descriptor. A return value of null will cause the server to use the DiscoveryFactory's default provider.

Returns:
The discovery descriptor or null if the default discovery provider should be used.
Threading:
This method is safe for concurrent access by multiple threads.

addAcceptor

public final void addAcceptor(String descriptor)
Add a client acceptor to the acceptor set.

Parameters:
descriptor - The acceptor descriptor to add.
Threading:
This method is safe for concurrent access by multiple threads.

removeAcceptor

public final void removeAcceptor(String descriptor)
Remove a client acceptor from the acceptor set.

Parameters:
descriptor - The acceptor descriptor to remove .
Threading:
This method is safe for concurrent access by multiple threads.

getAcceptors

public final Set<String> getAcceptors()
Get the configured list of client acceptors.

Returns:
Returns the list of configured client acceptors.

This method returns the list of acceptors to start in the server to accept incoming client connections.

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

setClientHandshakeTimeout

public final void setClientHandshakeTimeout(int timeout)
Set the client handshake timeout.

Parameters:
timeout - The handshake timeout to set (in seconds)
Threading:
This method is safe for concurrent access by multiple threads.

getClientHandshakeTimeout

public final int getClientHandshakeTimeout()
Get the client handshake timeout.

Returns:
Returns the maximum time that a server will wait for handshake request to arrive from a client during the initial connection handshake.

This method returns the configured client handshake timeout i.e. the maximum time (in seconds) that the server will wait for the handshake request to arrive from the client.

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

addApp

public final void addApp(SrvConfigAppDescriptor app)
Add a server app to the app set.

Parameters:
app - The app to add.
Threading:
This method is safe for concurrent access by multiple threads.

getApp

public final SrvConfigAppDescriptor getApp(String appName)
Get a server app from the app set.

Parameters:
appName - The name of the app to retrieve.
Returns:
Returns the app of the supplied name or null if not found.
Threading:
This method is safe for concurrent access by multiple threads.

removeApp

public final void removeApp(String appName)
Remove a server app from the app set.

Parameters:
appName - The name of the app to remove.
Threading:
This method is safe for concurrent access by multiple threads.

getApps

public final Set<SrvConfigAppDescriptor> getApps()
Get the configured list of server apps.

Returns:
Returns the list of configured server apps.

This method returns the set of server apps to load at server startup.

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

getAppNames

public final Set<String> getAppNames()
Get the names of the configured list of server apps.

Returns:
Returns the list of configured server apps.

This method returns the set of server apps to load at server startup.

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

setOtherProperty

public final void setOtherProperty(String name,
                                   String val)
Set a non-server property.

Parameters:
name - The property name.
Threading:
This method is safe for concurrent access by multiple threads.

getOtherProperty

public final String getOtherProperty(String name)
Get a non-server property

Parameters:
name - The property name
Threading:
This method is safe for concurrent access by multiple threads.

getOtherProperties

public final Properties getOtherProperties()
Get all non-server properties.

Returns:
Returns the set of non-server properties
Threading:
This method is safe for concurrent access by multiple threads.

load

public final SrvConfigDescriptor load(Properties props,
                                      boolean shortForm)
Load descriptor from properties in a property table.

Parameters:
props - The property table to load the descriptor from.
shortForm - This parameter indicates whether the method should use the long or short for for property names in the table. the long form of properties are of the form 'nv.server.' while the short form is simple ''.
Threading:
This method is safe for concurrent access by multiple threads.

save

public final Properties save(Properties props,
                             boolean shortForm)
Save a server descriptor to a property table.

Parameters:
props - The property table to save the descriptor to.
shortForm - This parameter indicates whether the method should use the long or short for for property names when saving the descriptor to the table. The long form are propertis of the form 'nv.server.' while the short form is the simple ''.
Throws:
ESrvConfigException - Thrown in case an error in encountered during the saving of the descriptor.
Threading:
This method is notsafe for concurrent access by multiple threads.

save

public final void save(IConfigRepository repo)
                throws ESrvConfigException
Save a server descriptor to a configuration repository.

Parameters:
repo - The configuration respository to save the descriptor in.
Throws:
ESrvConfigException - Thrown in case an error in encountered during the saving of the descriptor.
Threading:
This method is notsafe for concurrent access by multiple threads.

This method saves a server descriptor to a configuration repository. The descriptor is saved in a format suitable for loading subsequently using any of the load methods offered by this class.


save

public final void save()
                throws ESrvConfigException
Save a server descriptor to the default configuration repository.

Throws:
ESrvConfigException
Threading:
This method is notsafe for concurrent access by multiple threads.

This method saves a server descriptor to the default configuration respository. The descriptor is saved in a format suitable for loading subsequently using any of the load methods offered by this class.


delete

public final void delete(IConfigRepository repo)
                  throws ESrvConfigException
Delete a server descriptor from a configuration repository.

Parameters:
repo - The configuration respository to delete the sever from.
Throws:
ESrvConfigException - Thrown in case an error in encountered during the deletion of the descriptor.
Threading:
This method is notsafe for concurrent access by multiple threads.

This method deletes a server descriptor from a configuration repository.


toString

public final String toString()
Return a string representation of this object

Overrides:
toString in class Object

create

public static SrvConfigDescriptor create(String name)
Create a default server descriptor instance.

Parameters:
name - The name of the server described by the created descriptor. The server name can be specified as null. If so, the server name will be set to the the value returned by XRuntime.getAppName()
Returns:
Returns the created server descriptor.
Threading:
This method is safe for concurrent access by multiple threads.

createFromEnvironment

public static SrvConfigDescriptor createFromEnvironment()
Create a server descriptor instance initialized from the environment.

Returns:
Returns the created configuration descriptor.
Threading:
This method is safe for concurrent access by multiple threads.

create

public static SrvConfigDescriptor create(com.neeve.util.UtlAddressDescriptor descriptor)
Create a server descriptor from an address descriptor object

Parameters:
descriptor - The address descriptor using which to create the server descriptor.
Threading:
This method is safe for concurrent access by multiple threads.

This method creates and initializes a server descriptor from the an address descriptor of the following form:

server://&prop=val&...&nv.server.apps=appdesc1,..., appdescN...&prop=val The creation process instantiate the apps described in the server descriptor string.


load

public static SrvConfigDescriptor load(IConfigRepository repo,
                                       String name)
                                throws ESrvConfigException
Create a server descriptor from a configuration repository.

Parameters:
repo - The configuration respository to create the descriptor from.
name - The name of the server whose descriptor is to be loaded.
Throws:
ESrvConfigException
Threading:
This method is safe for concurrent access by multiple threads.

This method creates and initializes a server descriptor from a configuration repository.


loadAll

public static Set<SrvConfigDescriptor> loadAll(IConfigRepository repo)
                                        throws ESrvConfigException
Create server descriptors for all servers in a configuration repository.

Parameters:
repo - The configuration respository from where to create the servers.
Returns:
Returns the set of server descriptors.

This method creates and initializes server descriptors for each of the servers configured in a configuration repository.

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

load

public static SrvConfigDescriptor load(String name)
                                throws ESrvConfigException
Create a server descriptor from the default configuration repository.

Parameters:
name - The name of the server whose descriptor is to be loaded.
Throws:
ESrvConfigException
Threading:
This method is safe for concurrent access by multiple threads.

This method creates and initializes a server descriptor from the default configuration repository.


loadAll

public static Set<SrvConfigDescriptor> loadAll()
                                        throws ESrvConfigException
Create server descriptors for all servers configured in the default configuration repository.

Returns:
Returns the set of server descriptors.

This method creates and initializes server descriptors for all the servers configured in the default configuration repository.

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


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