Uploaded image for project: 'mod_cluster'
  1. mod_cluster
  2. MODCLUSTER-142

Use UUID for auto-generated jvmRoute

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Done
    • Icon: Major Major
    • 1.1.0.CR2
    • 1.1.0.CR1
    • None
    • None

      Currently, auto-generated jvm-routes are of the form: bind-address:port:engine-name
      This exposes internal addresses/ports and is not appropriate for production systems.
      To fix that, we can use UUIDs.
      e.g.

      InetAddress connectorAddress;
      int connectorPort;
      String engineName;

      int addressBytes = connectorAddress.getAddress().length;
      int intBytes = Integer.SIZE / Byte.SIZE;
      int charBytes = Character.SIZE / Byte.SIZE;

      ByteBuffer buffer = ByteBuffer.allocate(addressBytes + intBytes + (engineName.length() * charBytes));
      buffer.put(connectorAddress.getAddress());
      buffer.putInt(connectorPort);
      buffer.asCharBuffer().put(engine);

      String jvmRoute = UUID.nameUUIDFromBytes(buffer.array()).toString();

      I can think of 2 disadvantages:
      1. UUID jvm-routes will be, on average, longer than the current default, i.e. 36 characters as opposed to ~28. Not a significant difference there.
      2. For development, exposing the address and port via the jvm route might be useful. To satisfy this requirement, we can make the use of UUIDs configurable.

            pferraro@redhat.com Paul Ferraro
            pferraro@redhat.com Paul Ferraro
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: