-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Break inheritance dependency on java.lang.Process #20235
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
We have a parallel antipattern in our docker stack (see: DockerProcessFactory
). I was surprised that this change was possible without having to touch it. Maybe that says something about code reuse about K8s and docker impls. Don't know if it is worth doing this in DockerProcessFactory
too. This PR is good though and should not be blocked on that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jdpgrailsdev just to make sure I understand, this change makes it so that we continue to use the Process interface (which we want) while restricting consumer of Airbyte process implementation from accessing Process interface internal information (which we don't want).
Is that right?
airbyte-commons-worker/src/main/java/io/airbyte/workers/process/KubePodProcess.java
Show resolved
Hide resolved
@davinchia Exactly correct. We still want to represent it as a process, without the extra baggage of extending the |
@cgardens I'll take a look at |
@cgardens I took a look at |
What
java.lang.Process
to avoid issues caused by partial implementationHow
java.lang.Process
java.lang.Process
implementation from existing "process" objectsThis PR is inspired by a discussion following an incident where the use of
.pid()
inKubePodProcess
lead to failures, as the parent class (java.lang.Process
) throws exceptions for certain non-abstract, public methods that are not implemented by the child class. More broadly speaking, the classes that we have identified as "processes" are not really processes in the Java sense (e.g. they are not native processes provided by an operating system). This change will break that dependency so that changes made to these classes will not be exposed to the problem outlined above (e.g. calling a method on the parent class that is not and cannot really be implemented by the child class due to the fact that it is not a true native process). This is analogous to extendingjava.lang.Thread
instead of implementingRunnable
orCallable
.Recommended reading order
KubePod.java
KubePodProcess.java
AsyncOrchestratorPodProcess.java
KubeProcessFactory.java
Tests