MpxjEx.Server (MpxjEx v0.1.0)

Copy Markdown View Source

A long running JVM that handles read and convert requests.

By default every MpxjEx.read/2 or MpxjEx.convert/3 call starts a new JVM, which costs around half a second. When you read many files, start a server in your supervision tree and pass it with the :server option (or configure it once with config :mpxj_ex, server: MpxjEx.Server):

children = [
  {MpxjEx.Server, name: MpxjEx.Server, pool_size: 4, max_memory: "2g"}
]

MpxjEx.read("plan.mpp", server: MpxjEx.Server)

The JVM processes up to :pool_size requests concurrently. If it exits, pending callers get a :jvm_crashed error and the server stops, so its supervisor can restart it.

Options

  • :name - name to register the server under
  • :pool_size - number of requests handled concurrently (defaults to System.schedulers_online/0)
  • :max_memory - JVM maximum heap size, such as "2g"
  • :java - path to the java executable
  • :jvm_args - extra arguments for the JVM

Summary

Functions

Returns a specification to start this module under a supervisor.

Starts the server. See the module documentation for the options.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(opts \\ [])

@spec start_link(keyword()) :: GenServer.on_start()

Starts the server. See the module documentation for the options.