# How to cancel a worklow which is sleeping?

**URL:** <https://community.temporal.io/t/how-to-cancel-a-worklow-which-is-sleeping/13486>\
**Category:** Community Support\
**Tags:** java-sdk\
**Created:** [September 10, 2024, 1:29pm UTC](https://community.temporal.io/t/how-to-cancel-a-worklow-which-is-sleeping/13486 "2024-09-10T13:29:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tuk](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/tuk/32/4039_2.png) [@tuk](https://community.temporal.io/u/tuk)\
**Post date:** [September 10, 2024, 1:29pm UTC](https://community.temporal.io/t/how-to-cancel-a-worklow-which-is-sleeping/13486/1 "2024-09-10T13:29:57Z")

</div>

Let’s say I have a worklow which is sleeping using `Workflow.sleep()`. How the workflow can be cancelled or I have to do one of the below

1. Use `terminate` instead of `cancel` or
2. `Workflow.await()` along with @SignalMethod should be used to finish the workflow

I am using Java SDK.

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [September 10, 2024, 4:46pm UTC](https://community.temporal.io/t/how-to-cancel-a-worklow-which-is-sleeping/13486/2 "2024-09-10T16:46:32Z")

</div>

There are many ways. The simplest one IMHO:

```auto
Workflow.newTimer().cancellableGet()

```

If you want to handle cancellation explicitly, you can always get a Promise that becomes ready when a scope is canceled.

```auto
Promise<String> cancellationPromise = CancellationScope.current().getCancellationRequest();

```

If you want to handle the notification asynchronously, use `Promise.thenAppy` or `Promise.handle`.
