ArrayList<Message> messages = new ArrayList<Message>();
// See if this backend config manager has a backend registered with the
// provided DN. If not, then we don't care if the entry is deleted.
Backend backend = registeredBackends.get(backendDN);
if (backend == null)
{
return new ConfigChangeResult(resultCode, adminActionRequired,
messages);
}
// See if the backend has any subordinate backends. If so, then it is not
// acceptable to remove it. Otherwise, it should be fine.
Backend[] subBackends = backend.getSubordinateBackends();
if ((subBackends == null) || (subBackends.length == 0))
{
registeredBackends.remove(backendDN);
try
{
backend.finalizeBackend();
}
catch (Exception e)
{
if (debugEnabled())
{
TRACER.debugCaught(DebugLogLevel.ERROR, e);
}
}
for (BackendInitializationListener listener :
DirectoryServer.getBackendInitializationListeners())
{
listener.performBackendFinalizationProcessing(backend);
}
DirectoryServer.deregisterBackend(backend);
configEntry.removeChangeListener(this);
// Remove the shared lock for this backend.
try
{
String lockFile = LockFileManager.getBackendLockFileName(backend);
StringBuilder failureReason = new StringBuilder();
if (! LockFileManager.releaseLock(lockFile, failureReason))
{
Message message = WARN_CONFIG_BACKEND_CANNOT_RELEASE_SHARED_LOCK.get(
backend.getBackendID(), String.valueOf(failureReason));
logError(message);
// FIXME -- Do we need to send an admin alert?
}
}
catch (Exception e2)
{
if (debugEnabled())
{
TRACER.debugCaught(DebugLogLevel.ERROR, e2);
}
Message message = WARN_CONFIG_BACKEND_CANNOT_RELEASE_SHARED_LOCK.get(
backend.getBackendID(), stackTraceToSingleLineString(e2));
logError(message);
// FIXME -- Do we need to send an admin alert?
}
return new ConfigChangeResult(resultCode, adminActionRequired,