aspose file tools*
The moose likes Web Services and the fly likes JAX-WS endPoint implementation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "JAX-WS endPoint implementation" Watch "JAX-WS endPoint implementation" New topic
Author

JAX-WS endPoint implementation

Sujoy Choudhury
Ranch Hand

Joined: Sep 17, 2008
Posts: 136

JAX-WS endPoint implementation class must not implement method.
Why?


Thanks and Regards,
~Sujoy
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
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!


My free books and tutorials: http://www.slideshare.net/krizsan
Sujoy Choudhury
Ranch Hand

Joined: Sep 17, 2008
Posts: 136

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

Joined: Oct 04, 2006
Posts: 2198
    
    1
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

Joined: Sep 17, 2008
Posts: 136

Right. That explanation seems more appropriate.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: JAX-WS endPoint implementation