posted 9 years ago
Hi Deepak,
The UserJobExecution class looks good except some encapsulation issues. Please find my suggestions below to narrow down the area.
1. Use generics for ThreadLocal return type.It will make it more readable. Where are you setting it?
2. Don't swallow the exception. Do you want to hit the service even when the user object is not available?
3. Use proper encapsulation in both the classes. you will never know who is changing the variables from outside.
4. Make the User class immutable to protect it. I don't think it should be mutable.
4. Use logs/assert in the execute method to verify whether everything is correct there. If everything looks fine, i guess the problem is inside the executeService or with the client.
Thanks
Avi