Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

AsyncOperation.java 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright (C) 2010, Google Inc. and others
  3. *
  4. * This program and the accompanying materials are made available under the
  5. * terms of the Eclipse Distribution License v. 1.0 which is available at
  6. * https://www.eclipse.org/org/documents/edl-v10.php.
  7. *
  8. * SPDX-License-Identifier: BSD-3-Clause
  9. */
  10. package org.eclipse.jgit.lib;
  11. /**
  12. * Asynchronous operation handle.
  13. *
  14. * Callers that start an asynchronous operation are supplied with a handle that
  15. * may be used to attempt cancellation of the operation if the caller does not
  16. * wish to continue.
  17. */
  18. public interface AsyncOperation {
  19. /**
  20. * Cancels the running task.
  21. *
  22. * Attempts to cancel execution of this task. This attempt will fail if the
  23. * task has already completed, already been cancelled, or could not be
  24. * cancelled for some other reason. If successful, and this task has not
  25. * started when cancel is called, this task should never run. If the task
  26. * has already started, then the mayInterruptIfRunning parameter determines
  27. * whether the thread executing this task should be interrupted in an
  28. * attempt to stop the task.
  29. *
  30. * @param mayInterruptIfRunning
  31. * true if the thread executing this task should be interrupted;
  32. * otherwise, in-progress tasks are allowed to complete
  33. * @return false if the task could not be cancelled, typically because it
  34. * has already completed normally; true otherwise
  35. */
  36. boolean cancel(boolean mayInterruptIfRunning);
  37. /**
  38. * Release resources used by the operation, including cancellation.
  39. */
  40. void release();
  41. }