@Retention(value=CLASS)
@Target(value=METHOD)
public @interface SupposeBackground
Ensures that the method is called from the background thread with (optionally) restrictions by allowed serials.
If it is not called from a supposed background thread, then IllegalStateException
will be thrown (by default).
Example :
@EBean
public class MyBean {
@SupposeBackground
boolean someMethodThatShouldNotBeCalledFromUiThread() {
//if this method will be called from the UI-thread an exception will be thrown
}
@SupposeBackground(serial = {"serial1", "serial2"})
boolean someMethodThatShouldBeCalledFromSerial1OrSerial2() {
//if this method will be called from another thread then a background thread with a
//serial "serial1" or "serial2", an exception will be thrown
}
}
| Modifier and Type | Optional Element and Description |
|---|---|
java.lang.String[] |
serial |
public abstract java.lang.String[] serial
BackgroundExecutor.checkBgThread(String...)Copyright © 2010-2014. All Rights Reserved.