/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at
* trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
* add the following below this CDDL HEADER, with the fields enclosed
* by brackets "[]" replaced with your own identifying information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
*/
/**
* This class provides an implementation of a Directory Server task that can
* be used to purge the replication historical informations stored in the
* user entries to solve conflicts.
*/
{
/**
* The default value for the maximum duration of the purge expressed in
* seconds.
*/
/**
* The tracer object for the debug logger.
*/
/**
* current historical purge delay
* <--------------------------------->
* -----------------------------------------------------------------> t
* | | |
* current task task
* CN being purged start date max end date
* <------------>
* config.purgeMaxDuration
*
* The task will start purging the change with the oldest CN found.
* The task run as long as :
* - the end date (computed from the configured max duration) is not reached
* - the CN purged is oldest than the configured historical purge delay
*
*
*/
{
if (debugEnabled())
{
}
}
/**
* {@inheritDoc}
*/
}
/**
* {@inheritDoc}
*/
{
{
return;
}
// FIXME -- Do we need any special authorization here?
try
{
// We can assume that this is an LDAP replication domain
}
catch(DirectoryException e)
{
}
if (maxDurationStringInSec != null)
{
try
{
}
catch(Exception e)
{
throw new DirectoryException(
}
}
}
/**
* {@inheritDoc}
*/
{
Boolean purgeCompletedInTime = false;
if (debugEnabled())
{
debugInfo("[PURGE] PurgeConflictsHistoricalTask is starting "
+ "max duration (sec):" + purgeTaskMaxDurationInSec);
}
try
{
// launch the task
purgeCompletedInTime = true;
}
catch(DirectoryException de)
{
debugInfo("[PURGE] PurgeConflictsHistoricalTask exception " +
{
// Error raised at submission time
}
else
{
}
}
finally
{
try
{
// sets in the attributes the last stats values
this.lastCN.toStringUI());
debugInfo("[PURGE] PurgeConflictsHistoricalTask write attrs ");
}
catch(Exception e)
{
debugInfo("[PURGE] PurgeConflictsHistoricalTask exception " +
e.getLocalizedMessage());
}
}
if (debugEnabled())
{
debugInfo("[PURGE] PurgeConflictsHistoricalTask is ending " +
" completedInTime:" + purgeCompletedInTime);
}
return initState;
}
int purgeCount;
/**
* Set the last changenumber purged and the count of purged values in order
* to monitor the historical purge.
* @param lastCN the last changeNumber purged.
* @param purgeCount the count of purged values.
*/
{
try
{
if (purgeCount == 0)
lastCN.toStringUI());
// we don't want the update of the task to overload too much task duration
this.purgeCount = purgeCount;
{
lastCN.toStringUI());
debugInfo("[PURGE] PurgeConflictsHistoricalTask write attrs "
+ purgeCount);
}
}
catch(DirectoryException de)
{
debugInfo("[PURGE] PurgeConflictsHistoricalTask exception " +
}
}
}