Can someone please explain the difference between the different types of clones, and what types of variables are copied to/from the pipeline?
I looked for a concise explanation on this topic and didn’t find anything terribly clear as it relates to the cloning of webMethods IData objects.
Here’s a useful paragraph or two from a recent Java World article:
The impact that I imply from this as it relates to cloning IData objects as part of invoking IS servcies on separate threads is that if your pipeline contains objects with methods that allow the data in those objects to be changed (mutator methods), a shallow copy of the pipeline (or any portion thereof) could result in opportunities for unintended consequences because the mutator methods on the copied objects could be used to make changes to the original object.
The deep clone avoids this but is much more expensive in terms of resources if the object being deep cloned contains a complex hierarchy of other objects that have mutator methods.
In a recent project we did not see performance problems when using deep clones, but the records being cloned did not contain other complex objects in most cases. We opted for deep cloning for the added protection against uninteded changes, but in retrospect it was probably unecessary given the low number of complex objects in our services.
Here are a few links that were helpful to me:
- http://www.javaworld.com/javaworld/javatips/jw-javatip76.html http://javatechniques.com/public/java/docs/basics/faster-deep-copy.html http://developer.java.sun.com/developer/JDCTechTips/2001/tt0410.html http://www.javaranch.com/campfire/StoryCups.jsp http://www.javaranch.com/campfire/StoryPassBy.jsp
If the Java / OO gurus out there want to jump in and clarify or correct my response, please feel free to do so.