Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JAX-WS endPoint implementation

 
Sujoy Choudhury
Ranch Hand
Posts: 136
Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JAX-WS endPoint implementation class must not implement method.
Why?
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
Probably because instances of endpoint implementation classes will be managed by a container.
Such management may include proxying or subclassing endpoint implementation class instances.
If an instance decided that it did not want to become garbage collected, then it would be difficult (impossible?) for the container to know and guarantee that the instance is in a usable state.
Remember that the instance may have been discarded due to a system exception having occurred.
JavaEE has other mechanisms, the @PreDestroy annotation, to annotate methods that are to perform cleanup before an instance is taken out of use.
Hope this at least helps you understand the motivation.
Best wishes!
 
Sujoy Choudhury
Ranch Hand
Posts: 136
Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply.

Probably because instances of endpoint implementation classes will be managed by a container.
Such management may include proxying or subclassing endpoint implementation class instances.


Yes I can understand for those reasons we can't declare the class final.

If an instance decided that it did not want to become garbage collected, then it would be difficult (impossible?) for the container to know and guarantee that the instance is in a usable state.
Remember that the instance may have been discarded due to a system exception having occurred.

But if you override finalize() method in that case the container may get benefited by calling that method before reclaiming the object (when gc runs).
So, I really didn't understand what did you mean here.
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

If an instance decided that it did not want to become garbage collected, then it would be difficult (impossible?) for the container to know and guarantee that the instance is in a usable state.
Remember that the instance may have been discarded due to a system exception having occurred.

But if you override finalize() method in that case the container may get benefited by calling that method before reclaiming the object (when gc runs).
So, I really didn't understand what did you mean here.

Quoting from the JavaSE API documentation of the finalize() method:
The finalize method may take any action, including making this object available again to other threads

Thus it seems to me that there are things that an instance may do in the finalize() method that are not suitable when being managed by a container.
Best wishes!
 
Sujoy Choudhury
Ranch Hand
Posts: 136
Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Right. That explanation seems more appropriate.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic