/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2007 Sun Microsystems Inc. All Rights Reserved
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: PeriodicRunnable.java,v 1.2 2008/06/25 05:52:51 qcheng Exp $
*
*/
/**
* Portions Copyrighted 2012 ForgeRock Inc
*/
/**
* Periodic task (task will be run periodically) which has handler integrated
* (implements ScheduleableAction) can be scheduled to Timer or TimerPool by
* using PeriodicRunnable. All the elements in the same PeriodicRunnable must
* have the same timeout period and run period. Elements will be grouped by
* using the time they enter PeriodicRunnable. Elements which entered
* PeriodicRunnable excess the timeout time will be checked 1 by 1 and
* ScheduleableAction (doAction()) will be invoked.
*/
protected long runPeriod;
protected long timeoutPeriod;
protected int containerNeeded;
protected boolean removeElementAfterAction;
/**
* Constructor of PeriodicRunnable.
*
* @param runPeriod The period of running this PeriodicRunnable
* @param timeoutPeriod The timeout period of the objects in this
* PeriodicRunnable
* @param removeElementAfterAction Whether to remove the elements after
* running the ScheduleableAction on the objects
*/
boolean removeElementAfterAction) throws
throw new IllegalArgumentException();
}
}
this.timeoutPeriod = timeoutPeriod;
for (int i = 0; i < containerNeeded; i++) {
}
}
/**
* Adds an element to this PeriodicRunnable.
*
* @param obj Element to be added to this PeriodicRunnable
* @return a boolean to indicate whether the add success
*/
}
}
/**
* Removes an element from this PeriodicRunnable.
*
* @param obj Element to be removed from this PeriodicRunnable
* @return A boolean to indicate whether the remove success
*/
// if the item is in groupNextTurn, don't lock groupThisTurn that won't
// block if the cleanup is in process
return true;
}
}
} else {
return true;
}
}
synchronized (thisTurn) {
}
}
/**
* Returns the timeout period of this PeriodicRunnable.
*
* @return A long value to indicate the timeout period
*/
public long getTimeoutPeriod() {
return timeoutPeriod;
}
/**
* Indicates whether this PeriodicRunnable is empty.
*
* @return A boolean to indicate whether this PeriodicRunnable is empty
*/
public boolean isEmpty() {
return false;
}
/**
* Returns the run period of this PeriodicRunnable.
*
* @return A long value to indicate the run period
*/
public long getRunPeriod() {
return runPeriod;
}
/**
* Implements for TaskRunnable. Run the function of ScheduleableAction on
* all the objects in thisTurn 1 by 1, and interchange thisTurn and
* nextTurn.
*/
public void run() {
synchronized (thisTurn) {
if (removeElementAfterAction) {
}
}
}
}
if (i == 0) {
} else {
if (i == containerNeeded) {
} else {
}
}
}
}
}
}