/*
 * Copyright 2013, Red Hat, Inc. and individual contributors as indicated by the
 * @author tags. See the copyright.txt file in the distribution for a full
 * listing of individual contributors.
 * 
 * This is free software; you can redistribute it and/or modify it under the
 * terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 * 
 * This software is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with this software; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
 * site: http://www.fsf.org.
 */
package org.zanata.service;

import java.io.Serializable;
import java.util.Collection;

import org.zanata.async.AsyncTask;
import org.zanata.async.AsyncTaskHandle;

/**
 * @author Carlos Munoz <a href="mailto:camunoz@redhat.com">camunoz@redhat.com</a>
 */
public interface AsyncTaskManagerService
{
   <V, H extends AsyncTaskHandle<V>> String startTask(AsyncTask<V, H> task);

   <V, H extends AsyncTaskHandle<V>> void startTask(AsyncTask<V, H> task, Serializable key);

   AsyncTaskHandle getHandle(String taskId);

   AsyncTaskHandle getHandleByKey(Serializable key);

   AsyncTaskHandle getHandle(String taskId, boolean removeIfFinished);

   Collection<AsyncTaskHandle> getAllHandles();

   void clearInactive();
}

@@ -1280,397 +1280,1743 @@
 %0A   
-%3CV, H extends AsyncTaskHandle%3CV%3E%3E String startTask(AsyncTask%3CV, H%3E task);%0A%0A   %3CV, H extends AsyncTaskHandle%3CV%3E%3E void startTask(AsyncTask%3CV, H%3E task, Serializable key);%0A%0A   AsyncTaskHandle getHandle(String taskId);%0A%0A   AsyncTaskHandle getHandleByKey(Serializable key);%0A%0A   AsyncTaskHandle getHandle(String taskId, boolean removeIfFinished);%0A%0A   Collection%3CAsyncTaskHandle%3E getAllHandles();%0A
+/**%0A    * Starts a task asynchronously.%0A    *%0A    * @param task The asynchronous task to run.%0A    * @return The key by which the handle for the task may be retrieved.%0A    */%0A   %3CV, H extends AsyncTaskHandle%3CV%3E%3E String startTask(AsyncTask%3CV, H%3E task);%0A%0A   /**%0A    * Starts a task asynchronously while providing a key to store the task's handle.%0A    * The handle may be retrieved later using the provided key.%0A    *%0A    * @param task The asynchronous task to run.%0A    * @param key The key that may be used to retrieve the task handle later.%0A    */%0A   %3CV, H extends AsyncTaskHandle%3CV%3E%3E void startTask(AsyncTask%3CV, H%3E task, Serializable key);%0A%0A   /**%0A    * Retrieves a task handle.%0A    *%0A    * @param taskId The task Id (as returned by %7B@link AsyncTaskManagerService#startTask(org.zanata.async.AsyncTask)%7D)%0A    * @return A task handle, or null if the task with said Id is not being handled by this service.%0A    */%0A   AsyncTaskHandle getHandle(String taskId);%0A%0A   /**%0A    * Retrieves a task handle.%0A    *%0A    * @param key The task id as provided to %7B@link AsyncTaskManagerService#startTask(org.zanata.async.AsyncTask, java.io.Serializable)%7D%0A    * @return A task handle, or null if there is no task with the provided id being handled by this service.%0A    */%0A   AsyncTaskHandle getHandleByKey(Serializable key);%0A%0A   AsyncTaskHandle getHandle(String taskId, boolean removeIfFinished);%0A%0A   /**%0A    * @return All handles for all tasks being managed by this service.%0A    */%0A   Collection%3CAsyncTaskHandle%3E getAllHandles();%0A%0A   /**%0A    * Clears all the inactive handles managed by this service.%0A    * Inactive handles all all those handles that reference a task that is either finished,%0A    * has encountered an error, or has been cancelled.%0A    */
 %0A   

Document AsyncTaskManagerService interface.