Package jade.core.messaging
Class PersistentDeliveryService
- java.lang.Object
-
- jade.core.BaseService
-
- jade.core.messaging.PersistentDeliveryService
-
- All Implemented Interfaces:
Service
public class PersistentDeliveryService extends BaseService
The JADE service to manage the persistent storage of undelivered ACL messages installed on the platform.- Author:
- Giovanni Rimassa - FRAMeTech s.r.l.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jade.core.Service
Service.Slice, Service.SliceProxy
-
-
Field Summary
Fields Modifier and Type Field Description static StringPERSISTENT_DELIVERY_BASEDIRThis constant is the name of the property whose value contains the root of the directory tree that is used to persist undelivered ACL messages when the file storage method is selected.static StringPERSISTENT_DELIVERY_FILTERThis constant is the name of the property whose value contains the name of the application-specific class that will be used by the PersistentDeliveryService on the local container as a filter for undelivered ACL messagesstatic StringPERSISTENT_DELIVERY_SENDFAILUREPERIODThis constant is the name of the property whose value contains an integer representing how often (in milliseconds) the PersistentDeliveryService will try to send again previously undelivered ACL messages which have been buffered.static StringPERSISTENT_DELIVERY_STORAGEMETHODThis constant is the name of the property whose value contains the storage method used to persist undelivered ACL messages by the PersistentDeliveryService on the local container.static StringPERSISTENT_DELIVERY_STORAGENODESThis constant is the name of the property whose value contains the semicolon separated names of the nodes where messages can be stored.-
Fields inherited from class jade.core.BaseService
ALL_DUMP_KEY, MAIN_SLICE, myFinder, myLogger, THIS_SLICE
-
Fields inherited from interface jade.core.Service
ADOPTED_NODE, DEAD_NODE, DEAD_PLATFORM_MANAGER, DEAD_REPLICA, DEAD_SLICE, NEW_NODE, NEW_REPLICA, NEW_SLICE, REATTACHED, RECONNECTED
-
-
Constructor Summary
Constructors Constructor Description PersistentDeliveryService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidboot(Profile myProfile)Activate the PersistentDeliveryManager and instantiate the PersistentDeliveryFilter.FiltergetCommandFilter(boolean direction)This should be properly implemented by the services that have filters.Class<?>getHorizontalInterface()This should be properly implemented by the services that have non-empty slices.Service.SlicegetLocalSlice()This should be properly implemented by the services that have non-empty slices.StringgetName()Retrieve the name of this service, that can be used to look up its slices in the Service Finder.voidinit(AgentContainer ac, Profile p)Performs the passive initialization step of the service.-
Methods inherited from class jade.core.BaseService
addAlias, broadcast, clearCachedSlice, createInvokator, dump, getAllSlices, getAMSBehaviour, getCommandSink, getFreshSlice, getHelper, getIMTPManager, getLocalNode, getNumberOfSlices, getOwnedCommands, getSlice, isLocal, lookupAlias, shutdown, stringifySlice, submit
-
-
-
-
Field Detail
-
PERSISTENT_DELIVERY_FILTER
public static final String PERSISTENT_DELIVERY_FILTER
This constant is the name of the property whose value contains the name of the application-specific class that will be used by the PersistentDeliveryService on the local container as a filter for undelivered ACL messages- See Also:
- Constant Field Values
-
PERSISTENT_DELIVERY_STORAGENODES
public static final String PERSISTENT_DELIVERY_STORAGENODES
This constant is the name of the property whose value contains the semicolon separated names of the nodes where messages can be stored. By default all nodes are considered. This implies that whenever the delivery of a message fails all slices are asked to see if they have a filer that must store the message. Similarly whenever a new agent is created all slices are asked to see if they have messages to flush. When the platform is composed by 100 or more containers (e.g. when there are mobile terminals running split containers) this may be very un-efficient --> using this option to limit the number of slices to be asked is highly recommended- See Also:
- Constant Field Values
-
PERSISTENT_DELIVERY_SENDFAILUREPERIOD
public static final String PERSISTENT_DELIVERY_SENDFAILUREPERIOD
This constant is the name of the property whose value contains an integer representing how often (in milliseconds) the PersistentDeliveryService will try to send again previously undelivered ACL messages which have been buffered.- See Also:
- Constant Field Values
-
PERSISTENT_DELIVERY_STORAGEMETHOD
public static final String PERSISTENT_DELIVERY_STORAGEMETHOD
This constant is the name of the property whose value contains the storage method used to persist undelivered ACL messages by the PersistentDeliveryService on the local container. The supported values for this parameter are:- file - A directory tree on the local filesystem is used.
- See Also:
- Constant Field Values
-
PERSISTENT_DELIVERY_BASEDIR
public static final String PERSISTENT_DELIVERY_BASEDIR
This constant is the name of the property whose value contains the root of the directory tree that is used to persist undelivered ACL messages when the file storage method is selected.- See Also:
- Constant Field Values
-
-
Method Detail
-
init
public void init(AgentContainer ac, Profile p) throws ProfileException
Description copied from interface:ServicePerforms the passive initialization step of the service. This method is called before activating the service. Its role should be simply the one of a constructor, setting up the internal data as needed. Service implementations should not use the Service Manager and Service Finder facilities from within this method. A distributed initialization protocol, if needed, should be exectuted within theboot()method.- Specified by:
initin interfaceService- Overrides:
initin classBaseService- Parameters:
ac- The agent container this service is activated on.p- The configuration profile for this service.- Throws:
ProfileException- If the given profile is not valid.
-
getName
public String getName()
Description copied from interface:ServiceRetrieve the name of this service, that can be used to look up its slices in the Service Finder.- Returns:
- The name of this service.
- See Also:
ServiceFinder
-
getHorizontalInterface
public Class<?> getHorizontalInterface()
Description copied from class:BaseServiceThis should be properly implemented by the services that have non-empty slices.- Specified by:
getHorizontalInterfacein interfaceService- Overrides:
getHorizontalInterfacein classBaseService- Returns:
- A
Classobject, representing the interface that is implemented by the slices of this service. Letsbe theClassobject corresponding to theService.Sliceinterface, and letcbe the returnedClassobject. Then, the two following conditions must hold:c.isInterface() == trues.isAssignableFrom(c) == true
-
getLocalSlice
public Service.Slice getLocalSlice()
Description copied from class:BaseServiceThis should be properly implemented by the services that have non-empty slices.- Specified by:
getLocalSlicein interfaceService- Overrides:
getLocalSlicein classBaseService- Returns:
- The slice of this service that resides on the local
platform node, or
nullif no such slice exists.
-
getCommandFilter
public Filter getCommandFilter(boolean direction)
Description copied from class:BaseServiceThis should be properly implemented by the services that have filters. Note that when called multiple times with the same value of thedirectionparameter this method MUST always return the same object!- Specified by:
getCommandFilterin interfaceService- Overrides:
getCommandFilterin classBaseService- Parameters:
direction- One of the two constantsFilter.INCOMINGandFilter.OUTGOING, distinguishing between the two filter chains managed by the command processor.- Returns:
- A
Filterobject, used by this service to intercept and process kernel-level commands. If the service does not wish to install a command filter for one or both directions, it can just returnnullwhen appropriate. - See Also:
CommandProcessor
-
boot
public void boot(Profile myProfile) throws ServiceException
Activate the PersistentDeliveryManager and instantiate the PersistentDeliveryFilter. Note that getting the MessagingService (required to instantiate the PersistentDeliveryManager) cannot be done in the init() method since at that time the MessagingService may not be installed yet.- Specified by:
bootin interfaceService- Overrides:
bootin classBaseService- Parameters:
myProfile- The configuration profile for this service.- Throws:
ServiceException- If a problem occurs during service initialization.
-
-