Package org.dwcj.bbjplugins.thread
Class BBjThreadProxy
java.lang.Object
org.dwcj.bbjplugins.thread.BBjThreadProxy
BBjThreadProxy, the Java-side interface to the BBj Thread Plug-In
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidabort()Notify the background thread to terminate gracefully.Allows direct access to the underlying class that extends BBjThread (This is probably most often not useful to the Java developer, only in some cases.)Retrieve a value manipulated by the background threadvoidkill()Kill the background threadvoidonFinished(Consumer<BBjThreadProxy> consumer) register an event callback that is executed as soon as the background thread finishesvoidonUpdate(Consumer<BBjThreadProxy> consumer) register an event callback that is executed whenever the background thread executes update()voidSet a value to be prepared and/or exchanged with the background processvoidstart()Start the background thread.
-
Constructor Details
-
BBjThreadProxy
Create a BBjThread class. You will typically pass a BBj class name in the form new BBjThreadProxy("::my/path/to/the/ThreadClass.bbj::ThreadClass") where ThreadClass extends BBjThread and implements the BBj side logic- Parameters:
className- : the BBj class name
-
-
Method Details
-
getBBjThreadInstance
Allows direct access to the underlying class that extends BBjThread (This is probably most often not useful to the Java developer, only in some cases.)- Returns:
- the instance of the BBjThread Object (BBj Object!)
-
setValue
Set a value to be prepared and/or exchanged with the background process- Parameters:
key- A String that serves as a key to the parameters mapvalue- An Object to exchange
-
getValue
Retrieve a value manipulated by the background thread- Parameters:
key- A String that serves as a key to the parameters map- Returns:
- The object passed by the background thread
-
onFinished
register an event callback that is executed as soon as the background thread finishes- Parameters:
consumer- The callback to notify
-
onUpdate
register an event callback that is executed whenever the background thread executes update()- Parameters:
consumer- The callback to notify
-
start
public void start()Start the background thread. -
kill
public void kill()Kill the background thread -
abort
public void abort()Notify the background thread to terminate gracefully. The BBj background thread can use shouldAbort() to determine if the foreground process requested its termination by using the abort() method.
-