Uploaded image for project: 'infrautils'
  1. infrautils
  2. INFRAUTILS-99

Revise DiagStatus API

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Medium Medium
    • 6.0.0
    • None
    • diagstatus

      There are a number of lifecycle problems in this API.

      ServiceRegistration is not idempotent. It would be nice if it were an AutoCloseable instance – yangtools.concepts.Registration preferrably, but we cannot quite have that now. Anyway unregister() should have a much-preferred idempotent close().

      Furthermore ServiceDescriptor takes moduleServiceName which is also supplied to DiagStatusService.register(). This means that ServiceRegistration knows this name and hence could provide a newDescriptor(ServiceState) method without users passing this in.

      Finally DiagStatusService.report() takes a ServiceDescriptor and a ServiceState, both of which are required.

      Let us have a:

      interface DiagStatus implements AutoCloseable {
      
         void report(ServiceState state);
      
         @Override
         close();
      }
      

      which replaces ServiceRegistration.

            rovarga Robert Varga
            rovarga Robert Varga
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: