Skip to content

Conversation

@ffbin
Copy link
Contributor

@ffbin ffbin commented Aug 12, 2015

In line 129, it close client in finally{} before throw exception.
But in line 105, it throw exception without close client.
So I think it is better to close client before throw RuntimeException.

@uce
Copy link
Contributor

uce commented Aug 12, 2015

I think the best thing would be to just move the try up a little.

@ffbin
Copy link
Contributor Author

ffbin commented Aug 12, 2015

@uce Thanks. What about remove "if(client.getTopologyJobId(name) != null) {...}" in line 103, because submitTopologyWithOpts() has check it at the head of function and will throw AlreadyAliveException.Then in finally{} close client.

@uce
Copy link
Contributor

uce commented Aug 12, 2015

If you move the try up, you can certainly remove the manual close. Regarding the check in 103, it really depends on whether the Strom compat layer depends on having only a single job per client. Therefore I would keep it in and let it throw the RuntimeException as before. The finally block will then make sure that the client is closed.

@hsaputra
Copy link
Contributor

Since getTopologyJobId can also throw exception, we could just move up the try-catch to include the call to that method and rely on finally to close the client.

@ffbin
Copy link
Contributor Author

ffbin commented Aug 13, 2015

@uce @hsaputra Thanks. I have move the try up and rely on finally to close the client.

@StephanEwen
Copy link
Contributor

Looks good, will merge this...

@hsaputra
Copy link
Contributor

All builds are failing though, not sure if bc this patch

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't declaration of client be outside of the try clause?

@StephanEwen
Copy link
Contributor

You are right, CI caught it. From my skimming over, the code looked good, but it does not compile...

@ffbin
Copy link
Contributor Author

ffbin commented Aug 15, 2015

@hsaputra @StephanEwen Thanks. I have fix my code error.

@hsaputra
Copy link
Contributor

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants