org.aselect.system.sam.agent
Class SAMResourceGroup

java.lang.Object
  extended by java.lang.Thread
      extended by org.aselect.system.sam.agent.SAMResourceGroup
All Implemented Interfaces:
java.lang.Runnable

public class SAMResourceGroup
extends java.lang.Thread

The SAM Resource Group is a Thread that represents a resource that will be checked every interval time.

Description:
SAM stands for Simple A-Select Management. SAM is designed to enable A-Select to work in a redundant envirnoment. A SAMResourceGroup resembles a group of entry points (SAMResources) to a particular resource (for example a database). The SAMResourceGroup will query the SAMResources periodically and keeps a list of active resources. When queried by an A-Select component, through the SAMAgent, the SAMResourceGroup will present the A-Select component an active SAMResource.

Concurrency issues:
-

Author:
Alfa & Ariss

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
SAMResourceGroup()
           
 
Method Summary
 void destroy()
          Destroys this resourcegroup (SAMResourceGroup) and all resources (SAMResource) within this group.
 SAMResource getActiveResource()
          Gets a active resource from this group.
 void init(java.lang.Object oConfigSection, ConfigManager oConfigManager, SystemLogger oSystemLogger)
          This function is to initialize the SAMAgent.
 void run()
          Default methode to start the update status Thread

 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SAMResourceGroup

public SAMResourceGroup()
Method Detail

init

public void init(java.lang.Object oConfigSection,
                 ConfigManager oConfigManager,
                 SystemLogger oSystemLogger)
          throws ASelectSAMException
This function is to initialize the SAMAgent.

Description:
Reads all resources configured inside a resourcegroup from the configuration and initializes them.

Concurrency issues:
-

Preconditions:
- oConfigSection != null
- oConfigManager != null
- oSystemLogger != null


Postconditions:
-

Parameters:
oConfigSection - The section within the configuration file in which the parameters for this SAMResourceGroup can be found.
oConfigManager - The ConfigManager used to retrieve the config from.
oSystemLogger - The logger used for system logging
Throws:
ASelectSAMException - if initialization fails.

getActiveResource

public SAMResource getActiveResource()
                              throws ASelectSAMException
Gets a active resource from this group.

Description:
Returns the first active resource (the active resource with the highest priority)

Concurrency issues:
-

Preconditions:
- The class variable _vActive may not be null
- All objects inside the class variable _vActive must be SAMResource objects.

Postconditions:
-

Returns:
The SAMResource object of an active resource.
Throws:
ASelectSAMException - If no active resource was found.

run

public void run()
Default methode to start the update status Thread

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread
See Also:
Thread.run()

destroy

public void destroy()
Destroys this resourcegroup (SAMResourceGroup) and all resources (SAMResource) within this group.

Overrides:
destroy in class java.lang.Thread
See Also:
Thread.destroy()


Copyright © 2008 SURFnet BV. All Rights Reserved.