*/
@Override
protected TaskState runTask()
{
// Get the specified client connection.
ClientConnection clientConnection = null;
for (ConnectionHandler<?> handler : DirectoryServer.getConnectionHandlers())
{
for (ClientConnection c : handler.getClientConnections())
{
if (c.getConnectionID() == connectionID)
{
clientConnection = c;
break;
}
}
}
// If there is no such client connection, then return an error. Otherwise,
// terminate it.
if (clientConnection == null)
{
Message message =
ERR_TASK_DISCONNECT_NO_SUCH_CONNECTION.get(
String.valueOf(connectionID));
logError(message);
return TaskState.COMPLETED_WITH_ERRORS;
}
else
{
clientConnection.disconnect(DisconnectReason.ADMIN_DISCONNECT,
notifyClient, disconnectMessage);
return TaskState.COMPLETED_SUCCESSFULLY;
}
}