# When You Cannot Afford to Block the EDT

DevFeed: [When You Cannot Afford to Block the EDT](<https://devfeed.tech/articles/when-you-cannot-afford-to-block-the-edt-19337.md>)

Original publisher: [Read original article](<https://www.codenameone.com/blog/invoke-without-blocking/>)

Author: Steve Hannah

Published: 2019-11-28T00:00:00Z

Content type: tutorial

Language: en

Sources: [CodeName One](<https://devfeed.tech/sources/codename-one.md>)

Topics: [ui](<https://devfeed.tech/topics/ui.md>), [Development](<https://devfeed.tech/topics/development.md>), [Code](<https://devfeed.tech/topics/code.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [App](<https://devfeed.tech/topics/app.md>), [Network](<https://devfeed.tech/topics/network.md>)

Tags: [asynchronous](<https://devfeed.tech/tags/asynchronous.md>), [blocking](<https://devfeed.tech/tags/blocking.md>), [development](<https://devfeed.tech/tags/development.md>), [network](<https://devfeed.tech/tags/network.md>), [programming](<https://devfeed.tech/tags/programming.md>), [request](<https://devfeed.tech/tags/request.md>), [server](<https://devfeed.tech/tags/server.md>), [ui](<https://devfeed.tech/tags/ui.md>)

## AI overview

The article explains how Codename One's CN.invokeWithoutBlocking() can prevent selected code sections from calling invokeAndBlock(), throwing BlockingDisallowedException when they do. It presents this as a way to identify blocking operations that could delay UI form construction and responsiveness, and recommends asynchronous requests when practical.

## Source excerpt

We recently added support for disabling invokeAndBlock() for certain sections of code. The syntax is: CN.invokeWithoutBlocking(()->{ // This code is not allowed to call invokeAndBlock() }); If any attempt is made to execute invokeAndBlock() inside that block of code, it will throw a BlockingDisallowedException. This can be useful for ensuring that your UI will be responsive, especially in cases where you're building a new form to show to the user, and any delay will be noticed by the user.