MethodIsBlockingException
Date: 2012-06-29

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.chromium.sdk.util
Class MethodIsBlockingException

    java.lang.Object
      java.lang.Throwable
          java.lang.Exception
              java.lang.RuntimeException
                  org.chromium.sdk.util.MethodIsBlockingException

All Implemented Interfaces:
  java.io.Serializable

    public class MethodIsBlockingException

extends java.lang.RuntimeException

Signals that a deadlock was about to happen.

Method may wait for some callback to receive a result from some worker thread. If this method happened to be called from another callback being run by the same thread this will block the thread forever because method is never going to get result. Such situation may raise this exception.

Currently this exception is never actually thrown so it gets more of symbolic sense. Nevertheless it's still important to keep its declaration because it helps to track which ones are blocking and which are not. To do this, one should temporarily modify this class and make exception checked (make it extend `java.lang.Exception`). This will enforce the proper declaration of all blocking methods.

Here are the simple rules: you never normally catch this exception, but add throws declaration wherever needed; if your callback method needs to throw it you are doing something wrong (i.e. calling blocking method from a callback) and risk running into a deadlock; wherever you are sure you are on a safe ground (not called from callback) and there is no need in further tracking this exception, make a symbolic try/catch and explain why you think it's safe, in a catch block:

       try {
         makeSureAllScriptsAreLoaded();
       } catch (MethodIsBlockingException e) {
         // I'm being called from my own thread, so it's ok if method blocks,
         // I can wait
         throw new RuntimeException(e); // never executed
       }

By default, `MethodIsBlockingException` is unchecked exception, so you may completely ignore it.

See Also:
  Serialized Form

Method Summary

Methods inherited from class java.lang.Throwable
`fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD