Package jline.io

Class LinePorts

java.lang.Object
jline.io.LinePorts

public final class LinePorts extends Object
Host ports of the LINE service containers.

Every imperialqore/*-rest image listens on 8080 inside its container; that is the image contract and does not change. What is allocated here is the host port each service is published on by default, so that two LINE services can run side by side. Mirrors matlab/src/io/line_ports.m, line_solver.api.io.ports and cpp/include/line/io/line_ports.h; the four tables must agree.

The block 29200-29229 is unassigned in the IANA registry, needs no root to bind, and sits below 32768, the floor of the Linux ephemeral range: RFC 6335 points unregistered services at 49152-65535, but that is where operating systems draw outbound source ports from, so a fixed listener there can lose its bind to an outgoing connection, intermittently and only under load.

Offsets are permanent: one is retired, never reused for another tool. Offset 0 is kept free for an aggregating gateway; offsets 5-15 are reserved for the wrapper packages that ship outside this tree.

Copyright (c) 2012-2026, Imperial College London All rights reserved.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    First host port of the reserved block.
    static final int
    Last host port of the reserved block.
    static final int
    Port every service image listens on inside its container.
    static final int
    imperialqore/jmt-rest.
    static final int
    imperialqore/ldes-rest.
    static final int
    Host port every service used before the allocation (the old documented docker run -p 8080:8080); consulted only as a fallback verified through /api/v1/info.
    static final String
    Default options.config.remote_url of SolverLQNS.
    static final int
    imperialqore/line-lqns-rest (lqns, lqsim and qnsolver share the image).
    static final int
    imperialqore/line-sage-rest.
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    allocate(int offset)
    Host port for a given offset within the LINE block.
    static String
    defaultUrl(int port)
    Base URL a service published on port of localhost is reachable at.
    static boolean
    isHealthy(String baseUrl)
    True when <baseUrl>/api/v1/health answers 2xx.
    static boolean
    True when /api/v1/info lists a tool named lqns.
    static String
    resolveLqnsUrl(String configured)
    URL the SolverLQNS remote path should post to, given options.config.remote_url.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • BLOCK_FIRST

      public static final int BLOCK_FIRST
      First host port of the reserved block.
      See Also:
    • BLOCK_LAST

      public static final int BLOCK_LAST
      Last host port of the reserved block.
      See Also:
    • CONTAINER_PORT

      public static final int CONTAINER_PORT
      Port every service image listens on inside its container.
      See Also:
    • LEGACY_PORT

      public static final int LEGACY_PORT
      Host port every service used before the allocation (the old documented docker run -p 8080:8080); consulted only as a fallback verified through /api/v1/info.
      See Also:
    • JMT_PORT

      public static final int JMT_PORT
      imperialqore/jmt-rest.
    • LQNS_PORT

      public static final int LQNS_PORT
      imperialqore/line-lqns-rest (lqns, lqsim and qnsolver share the image).
    • LDES_PORT

      public static final int LDES_PORT
      imperialqore/ldes-rest.
    • SAGE_PORT

      public static final int SAGE_PORT
      imperialqore/line-sage-rest.
    • LQNS_DEFAULT_URL

      public static final String LQNS_DEFAULT_URL
      Default options.config.remote_url of SolverLQNS.
  • Method Details

    • allocate

      public static int allocate(int offset)
      Host port for a given offset within the LINE block.
      Parameters:
      offset - position in the block, 0-29
      Returns:
      the absolute host port
      Throws:
      IllegalArgumentException - if the offset falls outside the block
    • defaultUrl

      public static String defaultUrl(int port)
      Base URL a service published on port of localhost is reachable at.
      Parameters:
      port - host port
      Returns:
      http://localhost:<port>
    • resolveLqnsUrl

      public static String resolveLqnsUrl(String configured)
      URL the SolverLQNS remote path should post to, given options.config.remote_url.

      A URL other than the default is used exactly as given. The default is used when it answers; otherwise an lqns-rest still published on the legacy port 8080, verified through /api/v1/info, is used with a warning telling the user to republish it. When neither answers the default is returned, so the request fails naming the URL the service is expected at.

      Parameters:
      configured - options.config.remote_url
      Returns:
      the URL to use
    • isHealthy

      public static boolean isHealthy(String baseUrl)
      True when <baseUrl>/api/v1/health answers 2xx.
      Parameters:
      baseUrl - service base URL
      Returns:
      whether the service is up
    • isLqnsService

      public static boolean isLqnsService(String baseUrl)
      True when /api/v1/info lists a tool named lqns. Identity is read, not assumed from the port: a line-sage-rest started by hand on 8080 answers /health just as an lqns-rest does.
      Parameters:
      baseUrl - service base URL
      Returns:
      whether the service is lqns-rest