Package jadex.platform.service.registry
Class AutoConfigRegistryAgent
- java.lang.Object
- 
- jadex.platform.service.registry.AutoConfigRegistryAgent
 
- 
- All Implemented Interfaces:
- IAutoConfigRegistryService
 
 public class AutoConfigRegistryAgent extends java.lang.Object implements IAutoConfigRegistryService Agent that observes the environment and decides to a) make this platform to a SP registry (upgrade) b) make this platform from a SP registry to a normal client (downgrade)
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classAutoConfigRegistryAgent.CountingEnum as result type for counting.classAutoConfigRegistryAgent.ResultCountTrackerHelper class for tracking the results and deciding if too_less or many superpeers have been found.
 - 
Field SummaryFields Modifier and Type Field Description protected IFuture<java.lang.Void>activefutprotected IInternalAccessagentThe agent.protected longcheckdelayprotected intmax_repRepeat search until action.protected intmax_spsMaximum number of sps .protected intmin_spsMinimum number of superpeers (sps) .
 - 
Constructor SummaryConstructors Constructor Description AutoConfigRegistryAgent()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description IFuture<java.lang.Void>activate()Activate the config service.voidbody()The agent body.Future<java.lang.Double>computePower(IServiceIdentifier sid)Compute how good a host is suited for being a superpeer.protected IFuture<java.lang.Number[]>fetchPowerValues(IServiceIdentifier sid)Fetch power values from a host.protected IFuture<java.util.Set<Tuple2<IAutoConfigRegistryService,java.lang.Double>>>findPeers()Find normal peers (to select one or more from them).protected IServiceRegistrygetRegistry()Get the registry.protected IServiceIdentifiergetSid()Get own service id for autoconfig service.protected booleanisSuperpeer()Test if this platform is superpeer.protected IFuture<java.lang.Void>makeClient(IComponentIdentifier cid)Make another platform to normal peer.IFuture<java.lang.Void>makeRegistryClient()Make this platform registry client.IFuture<java.lang.Void>makeRegistrySuperpeer()Make this platform registry superpeer.protected IFuture<java.lang.Void>makeSuperpeer(IComponentIdentifier cid)Make another platform to superpeer.protected voidsearchAfterDelay(AutoConfigRegistryAgent.ResultCountTracker tracker)Initiate a search after a delay.protected IFuture<java.util.Collection<IAutoConfigRegistryService>>searchConfigurablePeers()Search the configurable peers, i.e.protected IFuture<java.util.Collection<ISuperpeerService>>searchConfigurableSuperpeers()Search the configurable superpeers, i.e.protected IFuture<java.lang.Void>searchForSuperpeers(AutoConfigRegistryAgent.ResultCountTracker tracker)Search for superpeers.
 
- 
- 
- 
Field Detail- 
agentprotected IInternalAccess agent The agent.
 - 
checkdelayprotected long checkdelay 
 - 
min_spsprotected int min_sps Minimum number of superpeers (sps) .
 - 
max_spsprotected int max_sps Maximum number of sps .
 - 
max_repprotected int max_rep Repeat search until action.
 - 
activefutprotected IFuture<java.lang.Void> activefut 
 
- 
 - 
Method Detail- 
bodypublic void body() The agent body.
 - 
activatepublic IFuture<java.lang.Void> activate() Activate the config service.- Specified by:
- activatein interface- IAutoConfigRegistryService
 
 - 
searchForSuperpeersprotected IFuture<java.lang.Void> searchForSuperpeers(AutoConfigRegistryAgent.ResultCountTracker tracker) Search for superpeers.
 - 
searchAfterDelayprotected void searchAfterDelay(AutoConfigRegistryAgent.ResultCountTracker tracker) Initiate a search after a delay.
 - 
findPeersprotected IFuture<java.util.Set<Tuple2<IAutoConfigRegistryService,java.lang.Double>>> findPeers() Find normal peers (to select one or more from them).
 - 
getSidprotected IServiceIdentifier getSid() Get own service id for autoconfig service.- Returns:
- The sid.
 
 - 
makeSuperpeerprotected IFuture<java.lang.Void> makeSuperpeer(IComponentIdentifier cid) Make another platform to superpeer.- Parameters:
- cid- The platform id.
 
 - 
makeClientprotected IFuture<java.lang.Void> makeClient(IComponentIdentifier cid) Make another platform to normal peer.- Parameters:
- cid- The platform id.
 
 - 
computePowerpublic Future<java.lang.Double> computePower(IServiceIdentifier sid) Compute how good a host is suited for being a superpeer.- Parameters:
- cid- The platform id.
- Returns:
- The power value.
 
 - 
fetchPowerValuesprotected IFuture<java.lang.Number[]> fetchPowerValues(IServiceIdentifier sid) Fetch power values from a host.
 - 
getRegistryprotected IServiceRegistry getRegistry() Get the registry.- Returns:
- The registry.
 
 - 
makeRegistrySuperpeerpublic IFuture<java.lang.Void> makeRegistrySuperpeer() Make this platform registry superpeer.- Specified by:
- makeRegistrySuperpeerin interface- IAutoConfigRegistryService
 
 - 
makeRegistryClientpublic IFuture<java.lang.Void> makeRegistryClient() Make this platform registry client.- Specified by:
- makeRegistryClientin interface- IAutoConfigRegistryService
 
 - 
isSuperpeerprotected boolean isSuperpeer() Test if this platform is superpeer.- Returns:
- True, if is superpeer.
 
 - 
searchConfigurableSuperpeersprotected IFuture<java.util.Collection<ISuperpeerService>> searchConfigurableSuperpeers() Search the configurable superpeers, i.e. those that can be up/downgraded.
 - 
searchConfigurablePeersprotected IFuture<java.util.Collection<IAutoConfigRegistryService>> searchConfigurablePeers() Search the configurable peers, i.e. those that can be up/downgraded.
 
- 
 
-