com.ibm.commerce.component.contextservice.commands

Class ActivityCleanUpCmdImpl

  • All Implemented Interfaces:
    AccCommand, ControllerCommand, ECCommand, ECTargetableCommand, ActivityCleanUpCmd, Protectable, com.ibm.websphere.cache.Sizeable, com.ibm.websphere.command.CacheableCommand, com.ibm.websphere.command.Command, com.ibm.websphere.command.CommandCaller, com.ibm.websphere.command.TargetableCommand, java.io.Serializable


    public class ActivityCleanUpCmdImpl
    extends ControllerCommandImpl
    implements ActivityCleanUpCmd
    Provides the implementation for the ActivityCleanUp scheduler command. This command is used to expire activities running for a given time and remove activities running for another specified amount of time.

    In particular, this command does two tasks:

    1. Expires activities that have been started in minutes, specified by the parameter maxIdleMinutes, prior to the time when the scheduler job is run.
    2. Removes activities that have been started in minutes, specified by the parameter maxRetainMinutes, prior to the time when the scheduler job is run.
    This command accepts the following parameters:
    • memberType - specifies the member types for whom activities will be expired and removed. The valid values are ('G', 'R', 'A', 'S')
    • status - specifies the status of the activities to be removed. Valid values are ('T', 'E', 'A').
    • maxIdleMinutes - for all selected activities, will change status from 'A' to 'E' if activities are started this number of minutes before.
    • maxRetainMinutes - for all selected activities, will remove them if are started this number of minutes before.
    • commitCount - number of activities to expire or remove in a transaction; default is 10000
    • maxRows - maximum number of activities to expire or remove; default is unlimited (-1)
    Sample job parameters will look something like this when passed to the scheduler command: memberType=GRAS&status=TE&maxIdleMinutes=1440&maxRetainMinutes=1440&commitCount=10000&maxRows=-1

    If maxIdleMinutes and maxRetainMinutes are the same and activities with a status 'E' are configured to be removed, all activities started maxIdleMinutes before are removed. This command can be used regardless whether the Activity Expiry feature is enabled or not. See the validateParameters method for the configuration details of this command.

    Note:

  • The time comparison is done on 24-hour days (more exact) as opposed to calendar days (which round down the last access time to previous midnight).
  • If the Activity Expiry feature is disabled, the activity’s last access time will be same as the activity’s start time. So the time comparison will be slightly off’ed.
  • The first implementation of this command will only work at the site level (i.e. no store ID specified) to avoid conflicts and confusion between scheduled jobs.
  • Warning:

    Use this command with extra caution. If the parameters are not set properly, it may remove activities that are still active and result in unhandled exceptions. As of d218975: - A commit-count of 10000 (ten thousand) is the default - The number of rows to be deleted is still "as many as possible" by default - Overrides are available to: - Change the commit-count to a larger number of records (commitCount), a smaller number of records, or to revert to all records (by specifying 0 or a negative number) - Change the "maximum number of rows to be modified" (maxRows) from "as many as possible" (specified by 0 or a negative number) to any number larger than 0
See Also:
Serialized Form
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM copyright notice field.
        See Also:
        Constant Field Values
      • CONST_COMMIT_COUNT

        public static final java.lang.String CONST_COMMIT_COUNT
        IBM copyright notice field.
        See Also:
        Constant Field Values
      • CONST_MAX_ROWS

        public static final java.lang.String CONST_MAX_ROWS
        IBM copyright notice field.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ActivityCleanUpCmdImpl

        public ActivityCleanUpCmdImpl()
        Constructs an ActivityCleanUpCmdImpl object.
    • Method Detail

      • performExecute

        public void performExecute()
                            throws ECException
        This method executes the scheduled command to expire and/or remove activities. See the validateParameters method for the configuration details of this command.
        Specified by:
        performExecute in interface ECCommand
        Specified by:
        performExecute in interface com.ibm.websphere.command.TargetableCommand
        Overrides:
        performExecute in class AbstractECTargetableCommand
        Throws:
        ECException - Throws any exception found from the command execution.
      • validateParameters

        public void validateParameters()
                                throws ECException
        This method validates the configurable parameters of this command. The configurable parameters are:
        • memberType - will select activities based on a given set of memberType (for example, 'G', 'R', 'S')
        • status - will select activities based on a given set of status (for example 'T', 'E', 'A')
        • maxIdleDays - for all selected activities, will change status from 'A' to 'E' if older than this # of days.
        • maxRetainDays - for all selected activities, will remove them if older than this # of days
        • commitCount - specifies number of records to be updated or deleted at a time, followed by a commit; default is 10000; values <= 0 imply all available
        • maxRows - specifies maximum number of rows to be updated or deleted; default is unlimited (-1 or any values <= 0)
        Specified by:
        validateParameters in interface ECCommand
        Overrides:
        validateParameters in class AbstractECTargetableCommand
        Throws:
        ECException - Throws any exception found during validation, mainly the ParameterNotFoundException or InvalidParameterValueException.