async2v.application package

Submodules:

Summary

Reference

class Application

Bases: threading.Thread

Manages the lifecycle of an async2v application at construction and runtime

Usually you want to use an ApplicationLauncher instead of instantiating an Application instance by hand.

start()

Start the application.

register(*components)

Register one or more components to the application.

  • When called before the application has been started, the given components are added immediately. They will be started upon application startup.
  • When called on a running application, a registration request is put on the main event queue and will be processed asynchronously within the main event loop. The components will be started immediately after the registration is complete.
Parameters:components (Component) –
Return type:None
deregister(*components)

Deregister one or more components from the application.

  • When called before the application has been started, the given components are removed immediately.
  • When called on a running application, a deregistration request is put on the event queue and will be processed asynchronously within the main event loop. The components will be stopped before the deregistration.
Parameters:components (Component) –
Return type:None
stop()

Stop the application.

The application is stopped by putting a shutdown request on the event queue. This method waits for the underlying thread to finish, hence can be deemed synchronous.

Return type:None
has_error_occurred()

Returns True if the application has been shut down or is being shut down due to an uncaught Exception in one of the components.

Return type:bool
run()

Implementation of the application thread. Don’t call this method directly, use start() instead.

Return type:None