-
Notifications
You must be signed in to change notification settings - Fork 344
Add close() method to io.opentracing.Tracer #302
Comments
IIRC, this library is still on Java 6, so, no default implementation for interfaces are available :/ |
I just checked the io.opentracing:parent:pom, and it has compiler source and target set to 1.7. |
There seems to be an override here: https://github.com/opentracing/opentracing-java/blob/master/opentracing-api/pom.xml#L32 |
That override had eluded me. The override is itself a bad practice. So how should this move forward?
|
This issue has come up a number of times before. Maybe worth searching for history for the arguments. Personally I am supportive of adding close(). While the reasons against raised previously are still valid, it is clear that community needs this mechanism to release the tracer and its resources. I believe we have close() in one of the languages (Python?) and there have been no complaints from implementors. However, backwards compatibility is an issue. |
Btw, option 4 to the list above - declare optional interface for closing and cast the tracer. |
Yes, this is an Option 4. However, this option is a hack that would further bury the primary issues (not having a close() on Tracer, and the jdk1.6 override). I believe Option 4 would be to incur a mindful technical debt. |
This was being addressed in #250 - maybe worth checking the arguments there (at the time we had decided to not add this method and put if in a FAQ, which... never happened). Personally I'd recommend we 1) do not override the Java version (to avoid confusion) and stick to Java 1.6 (using 1.7 or newer would require another discussion IHMO), and 2) if we add this close() method, add it directly to the |
I am going to close this as a dup of #250, please continue discussion on close() there. Regarding dropping 1.6 - a separate issue altogether. We had a similar 1.6 discussion jaegertracing/jaeger-client-java#511 and did not arrive at an agreement, and that's just a single implementation of the API. |
The Tracer interface does not define a close() method. Implementors of the Tracer interface, however, most often implement their own close() method to finalize traces, and to release resources. Since io.opentracing.Tracer.close() is not defined, application code that utilizes Tracer(s) must import the vendor-specific implementation in order for the close() method to be available. This effectively makes the application code coupled to the vendor, since the vendor-specific import is required.
By declaring a close() method in the io.opentracing.Tracer interface, vendor coupling can be avoided.
The close() method can be declared with a noop default, thus allowing for backward compatibility with all implementors of io.opentracing.Tracer that do not implement a close() method.
The text was updated successfully, but these errors were encountered: