Skip to content

Instantly share code, notes, and snippets.

@theboreddev
Created June 30, 2020 21:17
Show Gist options
  • Select an option

  • Save theboreddev/c5997cde4dba7fe98f5a61695fb545d1 to your computer and use it in GitHub Desktop.

Select an option

Save theboreddev/c5997cde4dba7fe98f5a61695fb545d1 to your computer and use it in GitHub Desktop.
synchronized
public class MyClass {
private MyAppState myAppState;
synchronized public void pleaseBlockMe() {
// omitted code
updateState();
// omitted code
}
private void updateState() {
//some expensive operation
}
static class MyAppState {
// some state logic here
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment