campy.private.backends.jbe.jbepipe module

Manage initialization of and communications to and from the Java backend.

The Java backend should live in a JAR file adjacent to this module.

The backend is initialized lazily, only created once someone tries to write to or read from the pipe. This means that the first call to the pipe will be slow, as it must take time to spawn the Java process.

class campy.private.backends.jbe.jbepipe.JavaBackendPipe[source]

Bases: object

A JavaBackendPipe connects to a single instance of a running JAR file.

A JavaBackendPipe knows how to write strings to the backend and how to read responses from the backend.

In order to avoid side-effects on import, the JAR is not run until a read or write is requested.

Implementation note: A JavaBackendPipe starts a thread to consume the output from the Java backend, so that the internal OS pipe is unlikely to fill up. When the JavaBackendPipe is deleted, the thread is joined as well.

get_result(consume_acks=True, stop_on_event=False, caller='')[source]
campy.private.backends.jbe.jbepipe.append_output_to_queue(out, queue)[source]