# Sleep in workflow

**URL:** <https://community.temporal.io/t/sleep-in-workflow/1650>\
**Category:** Community Support\
**Tags:** java-sdk, cassandra\
**Created:** [March 5, 2021, 4:18pm UTC](https://community.temporal.io/t/sleep-in-workflow/1650 "2021-03-05T16:18:34Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [March 5, 2021, 4:48pm UTC](https://community.temporal.io/t/sleep-in-workflow/1650/2 "2021-03-05T16:48:20Z")

</div>

TLDR; This works as designed.

Workflow code is executed only when a worker process receives so called _workflow task_. The workflow task has a timeout (default is 10 seconds). See [this post](https://community.temporal.io/t/what-is-the-difference-between-workflowruntimeout-and-workflowtasktimeout/1602/2) that explains the workflow task.

In your case, when a thread is blocked using the prohibited method (instead of supported `Workflow.sleep`) the deadlock detector aborts the workflow task. When a task is aborted WorkflowTaskFailed is recorded into the history. When you kill the worker, nothing is reported back to the service, so the workflow task timeout fires, and WorkflowTaskTimedOut is recorded into the history. In both cases, the task is retried to ensure that workflow continues execution.

---

_[View the full topic](https://community.temporal.io/t/sleep-in-workflow/1650)._
