aboutsummaryrefslogtreecommitdiff
path: root/docs/backends/start_stop.rst
blob: 6cd6f13a69f91477e34e33b10ccb3bb0a6a86eb3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Starting & cleaning up
======================

In case of most backends, you should only instantiate a backend once per 
application, as a backend typically allocates resources such as thread or
connection pools.

When ending the application, make sure to call ``backend.close()``, which will 
free up resources used by the backend (if any). The close process might be 
asynchronous, that is it can complete after the ``close()`` method returns.

Note that only resources allocated by the backends are freed. For example,
if you use the ``AkkaHttpBackend()`` the ``close()`` method will terminate the
underlying actor system. However, if you have provided an existing actor system
upon backend creation (``AkkaHttpBackend.usingActorSystem``), the ``close()`` 
method will be a no-op.