<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss'><id>tag:blogger.com,1999:blog-28828664</id><updated>2009-12-25T16:36:46.624Z</updated><title type='text'>notebook</title><subtitle type='html'></subtitle><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28828664/posts/default'/><link rel='alternate' type='text/html' href='http://www.gerald-loeffler.net/notebook/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.gerald-loeffler.net/notebook/atom.xml'/><author><name>Gerald Loeffler</name><email>noreply@blogger.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>5</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-28828664.post-6643722526650323304</id><published>2009-07-03T17:11:00.001+01:00</published><updated>2009-07-03T17:11:04.953+01:00</updated><title type='text'>IBM WebSphere MQ and JNDI</title><content type='html'>- configure JMSAdmin via WebSphere MQ/Java/bin/JMSAdmin.config, eg:&lt;br&gt;  INITIAL_CONTEXT_FACTORY=com.sun.jndi.fscontext.RefFSContextFactory&lt;br&gt;  PROVIDER_URL=file:/C:/path-to-file-based-jndi-tree&lt;br&gt;- create empty dir C:\path-to-file-based-jndi-tree&lt;br&gt; - create JNDI entries for queue connection factory and queue (the latter mapped to a MQ queue) via JMSAdmin, eg:&lt;br&gt;  def qcf(QCF)&lt;br&gt;  def q(JNDI_NAME_OF_QUEUE) qu(MQ_NATIVE_NAME_OF_QUEUE)&lt;br&gt;  end&lt;br&gt;&lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28828664-6643722526650323304?l=www.gerald-loeffler.net%2Fnotebook%2Findex.html' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28828664/posts/default/6643722526650323304'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28828664/posts/default/6643722526650323304'/><link rel='alternate' type='text/html' href='http://www.gerald-loeffler.net/notebook/index.html#6643722526650323304' title='IBM WebSphere MQ and JNDI'/><author><name>Gerald Loeffler</name><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='03181935375336126302'/></author></entry><entry><id>tag:blogger.com,1999:blog-28828664.post-5673901917116536608</id><published>2009-01-02T16:06:00.001Z</published><updated>2009-01-02T16:06:06.027Z</updated><title type='text'>Josh Bloch says</title><content type='html'>&lt;b&gt;1. Consider static factory methods instead of constructors&lt;/b&gt;&lt;br&gt;- have names (unlike constructors)&lt;br&gt;- are not required to create a new object each time they&amp;#39;re invoked (unlike constructors)&lt;br&gt;- can return an object of any subtype of their return type (unlike constructors)&lt;br&gt; - reduce the verbosity of creating parameterized type instances&lt;br&gt;- disadvantage of providing only static factory methods is that classes without public or protected constructors cannot be subclassed&lt;br&gt;- are not readily distinguishable from other static methods&lt;br&gt; &lt;b&gt;2. Consider a builder when faced with many constructor parameters&lt;/b&gt;&lt;br&gt;- the telescoping constructor pattern works, but it is hard to write and read client code when there are many parameters&lt;br&gt;- a JavaBean can not be immutable and may be in an inconsistent state partway through its construction&lt;br&gt; - Builder pattern simulates named optional parameters&lt;br&gt;- Class.newInstance breaks compile-time exception checking&lt;br&gt;- Builder pattern is a good choice when designing classes whose constructor or static factories would have more than a handful of parameters&lt;br&gt; &lt;b&gt;3. Enforce the singleton property with a private constructor or an enum type&lt;/b&gt;&lt;br&gt;- singletons can make it difficult to test a singleton&amp;#39;s clients&lt;br&gt;- a single-element enum type is the best way to implement a singleton&lt;br&gt; &lt;b&gt;4. Enforce noninstantiability with a private constructor&lt;/b&gt;&lt;br&gt;- attempting to enforce noninstantiability by making a class abstract does not work&lt;br&gt;&lt;b&gt;5. Avoid creating unnecessary objects&lt;/b&gt;&lt;br&gt;- prefer primitives to boxed primitives and watch out for unintentional autoboxing&lt;br&gt; &lt;b&gt;6. Eliminate obsolete object references&lt;/b&gt;&lt;br&gt;- nulling-out object references should be the exception rather than the norm&lt;br&gt;- be alert for memory leaks whenever a class manages its own memory&lt;br&gt;- common source of memory leaks: caches, listeners and other callbacks&lt;br&gt; &lt;b&gt;7. Avoid finalizers&lt;/b&gt;&lt;br&gt;- are unpredictable, often dangerous, and generally unnecessary&lt;br&gt;- never do anything time-critical in a finalizer&lt;br&gt;- never depend on a finalizer to update critical persistent state&lt;br&gt;- severe performance penalty for using finalizers&lt;br&gt; - provide explicit termination method to be used with try-finally to ensure termination&lt;br&gt;- finalizer should log a warning if it finds that the resource has not been terminated&lt;br&gt;&lt;b&gt;8. Obey the general contract when overriding equals&lt;/b&gt;&lt;br&gt; - do not override equals if&lt;br&gt;-- each instance is inherently unique&lt;br&gt;-- there is no need for a logical equality test&lt;br&gt;-- superclass equals is appropriate&lt;br&gt;-- class is private or package-private and you know that equals will never be invoked&lt;br&gt; - if equals contract is violated you don&amp;#39;t know how other objects will behave when confronted with your object&lt;br&gt;- there is no way to extend an instantiable class and add a value component while preserving the equals contract&lt;br&gt; - in your equals don&amp;#39;t depend on unreliable resources&lt;br&gt;&lt;b&gt;9. Always override hashCode when you override equals&lt;/b&gt;&lt;br&gt;- equal objects must have equal hash codes&lt;br&gt;- don&amp;#39;t exclude significant parts of an object from the hash code computation to improve performance&lt;br&gt; &lt;b&gt;10. Always override toString&lt;/b&gt;&lt;br&gt;- makes class more pleasant to use&lt;br&gt;- should return all interesting information contained in the object&lt;br&gt;- clearly document your intentions in specifying or not specifying the toString format&lt;br&gt; - provide programmatic access to all of the information contained in the value returned by toString&lt;br&gt;&lt;b&gt;11. Override clone judiciously&lt;/b&gt;&lt;br&gt;- if you override clone in a non-final class you should return an object obtained by invoking super.clone&lt;br&gt; - a class that implements Cloneable should provide a properly functioning clone method&lt;br&gt;- never make the client do anything the library can do for the client&lt;br&gt;- clone functions as another constructor: do not harm original object and properly establish invariants on the clone&lt;br&gt; - clone architecture is incompatible with normal use of final fields referring to mutable objects&lt;br&gt;- you&amp;#39;re better off providing an alternative means of object copying (copy constructor or copy factory), or simply not prividing the capability&lt;br&gt; &lt;b&gt;12. Consider implementing Comparable&lt;/b&gt;&lt;br&gt;&lt;b&gt;13. Minimize the accessibility of classes and members&lt;/b&gt;&lt;br&gt;- instance fields should never be public&lt;br&gt;- classes with public mutable fields are not thread-safe&lt;br&gt;- a class must not have a public static final array field, or a getter that returns such a field&lt;br&gt; &lt;b&gt;14. In public classes, use accessor methods, not public fields&lt;/b&gt;&lt;br&gt;- if a class is private or package-private there is nothing inherently wrong with exposing its data fields&lt;br&gt;&lt;b&gt;15. Minimize mutability&lt;/b&gt;&lt;br&gt;- to make class immutable&lt;br&gt; -- don&amp;#39;t provide methods that modify the object&amp;#39;s state&lt;br&gt;-- ensure that class can&amp;#39;t be extended&lt;br&gt;-- make all fields private and final&lt;br&gt;-- ensure exclusive access to any mutable components (make defensive copies)&lt;br&gt; - immutable objects are simple and thread-safe and can be shared freely&lt;br&gt;- classes should be immutable unless there&amp;#39;s a very good reason to make them mutable&lt;br&gt;- if a class nannot be made immutable, limit its mutability as much as possible&lt;br&gt; - make every field final unless there is a compelling reason to make it non-final&lt;br&gt;&lt;b&gt;16. Favor composition over inheritance&lt;/b&gt;&lt;br&gt;- inheritance violates encapsulation (unlike method invocation)&lt;br&gt;&lt;b&gt;17. Design and document for inheritance or else prohibit it&lt;/b&gt;&lt;br&gt; - a class must document its self-use of overridable methods&lt;br&gt;- may have to provide hooks into its internal workings in the form of protected methods&lt;br&gt;- test your class by writing subclasses&lt;br&gt;- constructors, clone and readObject must not invoke overridable methods (directly or indirectly)&lt;br&gt; - prohibit subclassing in classes that are not designed and documented to be safely subclassed&lt;br&gt;&lt;b&gt;18. Prefer interfaces to abstract classes&lt;/b&gt;&lt;br&gt;- existing classes can be easily retrofitted to implement a new interface&lt;br&gt; - interfaces are ideal for defining mixins&lt;br&gt;- interfaces allow the construction of non-hierarchical type frameworks&lt;br&gt;- interfaces enable safe, powerful functionality enhancement via the wrapper class idiom&lt;br&gt;- provide an abstract skeletal implementation class to go with each non-trivial interface that you export&lt;br&gt; - it is far easier to evlove an abstract class than an interface: once an interface is released it is almost impossible to change&lt;br&gt;&lt;b&gt;19. Use interfaces only to define types&lt;/b&gt;&lt;br&gt;- the constant interface pattern is a poor use of interfaces&lt;br&gt; &lt;b&gt;20. Prefer class hierarchies to tagged classes&lt;/b&gt;&lt;br&gt;- tagged classes are verbose, error-prone and inefficient&lt;br&gt;- a tagged class is just a pallid imitation of a class hierarchy&lt;br&gt;&lt;b&gt;21. Use function objects to represent strategies&lt;/b&gt;&lt;br&gt; &lt;b&gt;22. Favor static member classes over non-static&lt;/b&gt;&lt;br&gt;- if you declare a member class that does not require access to an enclosing instance, always put a static modifier in its declaration&lt;br&gt;&lt;b&gt;23. Don&amp;#39;t use raw types in new code&lt;/b&gt;&lt;br&gt; - if you use raw types you lose all the safety and expressiveness benefits of generics&lt;br&gt;- you don&amp;#39;t use type safety with a paremeterized type like List&amp;lt;Object&amp;gt;&lt;br&gt;- you can&amp;#39;t put any element other than null into a Collection&amp;lt;?&amp;gt;&lt;br&gt; - must use raw types in class literals&lt;br&gt;- after instanceof, cast to wildcard type&lt;br&gt;&lt;b&gt;24. Eliminate unchecked warnings&lt;/b&gt;&lt;br&gt;- only as a last resort, if you can prove type-safety, suppress the warning and document your reasoning&lt;br&gt; - suppress warnings on the smallest scope possible (local variable declaration or method)&lt;br&gt;&lt;b&gt;25. Prefer lists to arrays&lt;/b&gt;&lt;br&gt;&lt;b&gt;26. Favor generic types&lt;/b&gt;&lt;br&gt;&lt;b&gt;27. Favor generic methods&lt;/b&gt;&lt;br&gt;&lt;b&gt;28. Use bounded wildcards to increase API flexibility&lt;/b&gt;&lt;br&gt; - PECS: producer-extends, consumer-super&lt;br&gt;- don&amp;#39;t use wildcard types as return types&lt;br&gt;- if the user of a class has to think about wildcard types, there is probably something wrong with the class&amp;#39;s API&lt;br&gt;- always use Comparable&amp;lt;? super T&amp;gt; in preference to Comparable&amp;lt;T&amp;gt;&lt;br&gt; - always use Comparator&amp;lt;? super T&amp;gt; in preference to Comparator&amp;lt;T&amp;gt;&lt;br&gt;- if a type appears only once in a method declaration replace it with a wildcard&lt;br&gt;&lt;b&gt;29. Consider type-safe heterogeneous containers&lt;/b&gt;&lt;br&gt; - use Class&amp;lt;T&amp;gt; as type token and Class&amp;lt;T&amp;gt;.cast&lt;br&gt;&lt;b&gt;30. Use enums instead of int constants&lt;/b&gt;&lt;br&gt;- to associate data with enum constants, declare instance fields and write a constructor that takes the data and stores it in the fields&lt;br&gt; - use constant-specific method implementations&lt;br&gt;- switches on enums are only good for augmenting external enum types with constant-specific behavior&lt;br&gt;&lt;b&gt;31. Use instance fields instead of ordinals&lt;/b&gt;&lt;br&gt;- never derive a value associated with an enum from its ordinal: store it in an instance field instead&lt;br&gt; &lt;b&gt;32. Use EnumSet instead of bit fields&lt;/b&gt;&lt;br&gt;- just because an enumerated type will be used in sets, there is no reason to represent it with bit fields&lt;br&gt;&lt;b&gt;33. Use EnumMap instead of ordinal indexing&lt;/b&gt;&lt;br&gt;- it is rarely appropriate to use ordinals to index arrays: use EnumMap instead&lt;br&gt; &lt;b&gt;34. Emulate extensible enums with interfaces&lt;/b&gt;&lt;br&gt;- while you cannot write an extensible enum type, you can emulate it by writing an interface to go with a basic enum type that implements that interface&lt;br&gt;&lt;b&gt;35. Prefer annotations to naming patterns&lt;/b&gt;&lt;br&gt; - there is simply no reason to use naming patterns now that we have annotations&lt;br&gt;- use the predefined annotation types where possible&lt;br&gt;&lt;b&gt;36. Consistently use the Override annotation&lt;/b&gt;&lt;br&gt;- use @Override on every method declaration that you believe to override a superclass declaration&lt;br&gt; &lt;b&gt;37. Use marker interfaces to define types&lt;/b&gt;&lt;br&gt;- marker interfaces define a type that is implemented by instances of the marked class - marker annotations do not&lt;br&gt;- if you find yourself writing a marker annotation type whose target is ElementType.TYPE, take the time to figure out whether it really should be an annotation type, or whether a marker interface would bemore appropriate&lt;br&gt; &lt;b&gt;38. Check parameters for validity&lt;/b&gt;&lt;br&gt;&lt;b&gt;39. Make defensive copies when needed&lt;/b&gt;&lt;br&gt;- you must program defensively, with the assumption that clients of your class will do their best to destroy its invariants&lt;br&gt;- it is essential to make a defensive copy of each mutable parameter to the constructor&lt;br&gt; - defensive copies are made before checking the validity of the parameters, and the validity check is performed on the copies rather than the originals&lt;br&gt;- do not use the clone method to make a defensive copy of a parameter whose type is publicly subclassable&lt;br&gt; - return defensive copies of mutable internal fields&lt;br&gt;&lt;b&gt;40. Design method signatures carefully&lt;/b&gt;&lt;br&gt;- chose method names carefully&lt;br&gt;- don&amp;#39;t go overboard in providing convenience method: when in doubt, leave it out&lt;br&gt; - avoid long (4 or more) paremeter lists, especially if they are identically typed&lt;br&gt;- for parameter types, favor interfaces over classes&lt;br&gt;- prefer 2-element enum types to boolean parameters&lt;br&gt;&lt;b&gt;41. Use overloading judiciously&lt;/b&gt;&lt;br&gt; - the choice of which overloaded method to invoke is made at compile time and is static (while selection of overridden methods is dynamic)&lt;br&gt;- avoid confusing uses of overloading: never export 2 overloaded methods with the same number of parameters&lt;br&gt; &lt;b&gt;42. Use varargs judiciously&lt;/b&gt;&lt;br&gt;- use varargs only when a call really operates on a variable-length sequence of values (otherwise use arrays)&lt;br&gt;&lt;b&gt;43. Return empty arrays or collections, not nulls&lt;/b&gt;&lt;br&gt;- there is no reason to return null from an array- or collection-valued method instead of returning an empty array or collection&lt;br&gt; &lt;b&gt;44. Write doc comments for all exposed API elements&lt;/b&gt;&lt;br&gt;- document every exported class, interface, annotation, annotation member, enum, enum constant, type parameter, constructor, method and field declaration&lt;br&gt;- use {@code} or {@literal} to eliminate the need to escape HTML meta-characters&lt;br&gt; - no 2 members or constructors in a class or interface should have the same summary description&lt;br&gt;&lt;b&gt;45. Minimize the scope of local variables&lt;/b&gt;&lt;br&gt;- declare a local variable where it is first used&lt;br&gt;- nearly every local variable should contain an initializer&lt;br&gt; - prefer for loops to while loops&lt;br&gt;- keep methods small and focused&lt;br&gt;&lt;b&gt;46. Prefer for-each loops to traditional for loops&lt;/b&gt;&lt;br&gt;- cannot use a for-each loop for filtering, transforming or parallel iteration&lt;br&gt;&lt;b&gt;47. Know and use the libraries&lt;/b&gt;&lt;br&gt; &lt;b&gt;48. Avoid float and double if exact answers are required&lt;/b&gt;&lt;br&gt;- use BigDecimal, int (9 digits or less) or long (18 digits or less) for monetary calculations&lt;br&gt;&lt;b&gt;49. Prefer primitive types to boxed primitives&lt;/b&gt;&lt;br&gt; - applying the == operator to boxed primitives is almost always wrong&lt;br&gt;- when you mix primitives and boxed primitives in a single operation, the boxed primitive is auto-unboxed&lt;br&gt;- auto-boxing reduces the verbosity but not the danger of using boxed primitives&lt;br&gt; - unboxing can throw NullPointerException&lt;br&gt;&lt;b&gt;50. Avoid strings where other types are more appropriate&lt;/b&gt;&lt;br&gt;- strings are poos substitutes for other value types, enum types, aggregate types or capabilities&lt;br&gt;&lt;b&gt;51. Beware the performance of string concatenation&lt;/b&gt;&lt;br&gt; - using the string concatenation operator repeatedly to concatenate n strings requires time quadratic in n&lt;br&gt;- to achieve acceptable performance, use StringBuilder in place of a String&lt;br&gt;&lt;b&gt;52. Refer to objects by their interfaces&lt;/b&gt;&lt;br&gt; - if appropriate interface types exist, then parameters, return values, variables and fields should all be declared using interface types&lt;br&gt;- if you get into the habit of using interfaces as types, your program will be much more flexible&lt;br&gt; - it is entirely appropriate to refer to an object by a class rather than an interface if no appropriate interface exists&lt;br&gt;&lt;b&gt;53. Prefer interfaces to reflection&lt;/b&gt;&lt;br&gt;- object should not be accessed reflectively in normal applications at runtime&lt;br&gt; - create interfaces reflectively and access them normally via their interface or superclass&lt;br&gt;&lt;b&gt;54. Use native methods judiciously&lt;/b&gt;&lt;br&gt;- it is rarely advisable to use native methods for improved performance&lt;br&gt;&lt;b&gt;55. Optimize judiciously&lt;/b&gt;&lt;br&gt; - strive to write good programs rather than fast ones&lt;br&gt;- strive to avoid design decisions that limit performance&lt;br&gt;- consider the performance consequences of your API design decisions&lt;br&gt;- it is a very bad idea to warp an API to achieve good performance&lt;br&gt; - measure performance before and after each attempted optimization&lt;br&gt;&lt;b&gt;56. Adhere to generally accepted naming conventions&lt;/b&gt;&lt;br&gt;&lt;b&gt;57. Use exceptions only for exceptional conditions&lt;/b&gt;&lt;br&gt;- never use exceptions for ordinary control flow&lt;br&gt; - don&amp;#39;t force your API&amp;#39;s clients to use exceptions for ordinary control flow&lt;br&gt;&lt;b&gt;58. Use checked exceptions for recoverable conditions and runtime exceptions for programming errors&lt;/b&gt;&lt;br&gt;- use checked exceptions for conditions from which the caller can reasonably be expected to recover&lt;br&gt; - use runtime exceptions to indicate programming errors&lt;br&gt;- don&amp;#39;t implement Error subclasses&lt;br&gt;&lt;b&gt;59. Avoid unnecessary use of checked exceptions&lt;/b&gt;&lt;br&gt;&lt;b&gt;60. Favor the use of standard exceptions&lt;/b&gt;&lt;br&gt;- parameter values: IllegalArgumentException, NullPointerException, IndexOutOfBoundsException&lt;br&gt; - IllegalStateException&lt;br&gt;- UnsupportedOperationException&lt;br&gt;&lt;b&gt;61. Throw exceptions appropriate to the abstraction&lt;/b&gt;&lt;br&gt;- higher layers should catch lower-level exceptions and in their place throw exceptions that can be explained in terms of the higher-level abstraction&lt;br&gt; - if possible, deal with lower-level exceptions rather than translating them&lt;br&gt;&lt;b&gt;62. Document all exceptions thrown by each method&lt;/b&gt;&lt;br&gt;- declare checked exceptions individually using the throws keyword and document them&lt;br&gt; - also document each unchecked exception that a method can throw, but do not use the throws keyword&lt;br&gt;&lt;b&gt;63. Include failure-capture information in detail messages&lt;/b&gt;&lt;br&gt;- the detail message of an exception should contain the values of all parameters and fields that contributed to the exception&lt;br&gt; &lt;b&gt;64. Strive for failure atomicity&lt;/b&gt;&lt;br&gt;- a failed method invocation should leave the object in the state that it was in prior to the invocation&lt;br&gt;&lt;b&gt;65. Don&amp;#39;t ignore exceptions&lt;/b&gt;&lt;br&gt;- an empty catch block should contain a comment explaining why it is appropriate to ignore the exception&lt;br&gt; &lt;b&gt;66. Synchronize access to shared mutable data&lt;/b&gt;&lt;br&gt;- synchronization is required for reliable communication between threads as well as for mutual exclusion&lt;br&gt;- do not use Thread.stop&lt;br&gt;- synchronization has no effect unless both read and write operations are synchronized&lt;br&gt; - confine mutable data to a single thread&lt;br&gt;- when multiple threads share mutable data, each thread that reads or writes the data must perform synchronization&lt;br&gt;&lt;b&gt;67. Avoid excessive synchronization&lt;/b&gt;&lt;br&gt;- never cede control to the client within a synchronized method or block&lt;br&gt; - do as little work as possible inside synchronized regions&lt;br&gt;&lt;b&gt;68. Prefer executors and tasks to threads&lt;/b&gt;&lt;br&gt;- the key abstraction is no longer Thread - it is the unit of work (task) which is executed through an executor service&lt;br&gt; &lt;b&gt;69. Prefer concurrency utilities to wait and notify&lt;/b&gt;&lt;br&gt;- given the difficulty of using wait and notify correctly, you should use the higher-level concurrency utilities instead&lt;br&gt;- it is impossible to exclude concurrent activity from a concurrent collection; locking it will have no effect&lt;br&gt; - use ConcurrentHashMap in preference to Collections.synchronizedMap or Hashtable&lt;br&gt;- always use System.nanoTime in preference to System.currentTimeMillis&lt;br&gt;- always use the wait loop idiom: never invoke the wait method outside of a loop&lt;br&gt; &lt;b&gt;70. Document thread safety&lt;/b&gt;&lt;br&gt;- the synchronized modifier in a method declaration is an implementation detail, not a part of its exported API&lt;br&gt;- a class must clearly document what level of thread safety it supports: immutable, unconditionally thread-safe, conditionally thread-safe, not thread-safe, thread-hostile&lt;br&gt; &lt;b&gt;71. Use lazy initialization judiciously&lt;/b&gt;&lt;br&gt;- under most circumstances, normal initialization is preferable to lazy initialization&lt;br&gt;- for static fields use the lazy initialization holder class idiom&lt;br&gt;- for instance fields use the double-check idiom&lt;br&gt; &lt;b&gt;72. Don&amp;#39;t depend on the thread scheduler&lt;/b&gt;&lt;br&gt;- every program that relies on the thread scheduler for correctness or performance is likely to be nonportable&lt;br&gt;- threads should not run if they aren&amp;#39;t doing useful work&lt;br&gt; - don&amp;#39;t use Thread.yield - it has no testable semantics&lt;br&gt;- thread priorities are non-portable&lt;br&gt;&lt;b&gt;73. Avoid thread groups&lt;/b&gt;&lt;br&gt;- thread groups are obsolete&lt;br&gt;&lt;b&gt;74. Implement Serializable judiciously&lt;/b&gt;&lt;br&gt;- implementing Serializable decreases the flexibility to change a class&amp;#39; implementation once it has been released&lt;br&gt; - increases the likelihood of bugs and security holes&lt;br&gt;- increases the testing burden associated with releasing a new version of the class&lt;br&gt;- classes designed for inheritance should rarely implement Serializable, and interfaces should rarely extend it&lt;br&gt; - consider providing a parameterless constructor on non-serializable classes designed for inheritance&lt;br&gt;- inner classes should not implement Serializable: the default serialized form of an inner class is illdefined&lt;br&gt;&lt;b&gt;75. Consider using a custom serialized form&lt;/b&gt;&lt;br&gt; - do not accept the default serialized form without thought&lt;br&gt;- the default serialized form is likely to be appropriate if an object&amp;#39;s physical representation is identical to its logical content&lt;br&gt;- even if you decide that the default serialized form is appropriate, you often must provide a readObject method to ensure invariants and security&lt;br&gt; - before deciding to make a field non-transient, convince yourself that its value is part of the logical state of the object&lt;br&gt;- appropriately synchronize object serialization (writeObject)&lt;br&gt;- always declare an explicit serialVersionUID&lt;br&gt; &lt;b&gt;76. Write readObject methods defensively&lt;/b&gt;&lt;br&gt;- when an object is deserialized, defensively copy any field containing an object reference that a client must not possess&lt;br&gt;- do not use the writeUnshared and readUnshared methods&lt;br&gt; &lt;b&gt;77. For instance control, prefer enum types to readResolve&lt;/b&gt;&lt;br&gt;- if you depend on readResolve for instance control, all instance fields with object reference types must be declared transient&lt;br&gt;- the accessibility of readResolve is significant&lt;br&gt; &lt;b&gt;78. Consider serialization proxies instead of serialized instances&lt;/b&gt;&lt;br&gt;- whenever you find yourself having to write a readObject or writeObject method on a class that is not extendable by its clients&lt;br&gt;- perhaps the easiest way to robustly serialize objects with non-trivial invariants&lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28828664-5673901917116536608?l=www.gerald-loeffler.net%2Fnotebook%2Findex.html' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28828664/posts/default/5673901917116536608'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28828664/posts/default/5673901917116536608'/><link rel='alternate' type='text/html' href='http://www.gerald-loeffler.net/notebook/index.html#5673901917116536608' title='Josh Bloch says'/><author><name>Gerald Loeffler</name><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='03181935375336126302'/></author></entry><entry><id>tag:blogger.com,1999:blog-28828664.post-4020378523859998398</id><published>2007-02-14T15:36:00.001Z</published><updated>2007-02-14T15:36:36.164Z</updated><title type='text'>XSD for XML messages for CRUD operations</title><content type='html'>&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br&gt;&amp;lt;schema xmlns=&amp;quot;&lt;a href="http://www.w3.org/2001/XMLSchema"&gt;http://www.w3.org/2001/XMLSchema&lt;/a&gt;&amp;quot;&lt;br&gt;targetNamespace=&amp;quot;&lt;a href="http://www.example.org/sample"&gt;http://www.example.org/sample&lt;/a&gt;&amp;quot;&lt;br&gt;  xmlns:tns=&amp;quot;&lt;a href="http://www.example.org/sample"&gt;http://www.example.org/sample&lt;/a&gt;&amp;quot; elementFormDefault=&amp;quot;qualified&amp;quot;&amp;gt;&lt;p&gt;  &amp;lt;!-- type of id (for any type) --&amp;gt;&lt;br&gt;  &amp;lt;simpleType name=&amp;quot;idType&amp;quot;&amp;gt;&lt;br&gt;    &amp;lt;restriction base=&amp;quot;nonNegativeInteger&amp;quot; /&amp;gt;&lt;br&gt;  &amp;lt;/simpleType&amp;gt;&lt;p&gt;  &amp;lt;!-- id, version (for any type) as attribute group --&amp;gt;&lt;br&gt;  &amp;lt;attributeGroup name=&amp;quot;id_version&amp;quot;&amp;gt;&lt;br&gt;    &amp;lt;attribute name=&amp;quot;id&amp;quot; type=&amp;quot;tns:idType&amp;quot; use=&amp;quot;required&amp;quot; /&amp;gt;&lt;br&gt;    &amp;lt;attribute name=&amp;quot;version&amp;quot; type=&amp;quot;nonNegativeInteger&amp;quot; use=&amp;quot;required&amp;quot; /&amp;gt;&lt;br&gt;    &amp;lt;!-- or changeDate instead of version --&amp;gt;&lt;br&gt;  &amp;lt;/attributeGroup&amp;gt;&lt;p&gt;  &amp;lt;!-- creationDate, deletionDate (for any type) as attribute group --&amp;gt;&lt;br&gt;  &amp;lt;attributeGroup name=&amp;quot;creationDate_deletionDate&amp;quot;&amp;gt;&lt;br&gt;    &amp;lt;attribute name=&amp;quot;creationDate&amp;quot; type=&amp;quot;dateTime&amp;quot; use=&amp;quot;required&amp;quot; /&amp;gt;&lt;br&gt;    &amp;lt;attribute name=&amp;quot;deletionDate&amp;quot; type=&amp;quot;dateTime&amp;quot; /&amp;gt;&lt;br&gt;  &amp;lt;/attributeGroup&amp;gt;&lt;p&gt;  &amp;lt;!-- signatures of CRUD operations on Type:&lt;br&gt;    Type createNewType(TypeCreationState)&lt;br&gt;    Type updateExistingTypeToGivenState(TypeUpdateState)&lt;br&gt;    Type changeExistingTypeByGivenChanges(TypeChanges)&lt;br&gt;    Type findExistingTypeById(idType)&lt;br&gt;    Type deleteExsitingTypeById(idType)&lt;br&gt;  --&amp;gt;&lt;p&gt;  &amp;lt;element name=&amp;quot;type&amp;quot; type=&amp;quot;tns:Type&amp;quot; /&amp;gt;&lt;br&gt;  &amp;lt;element name=&amp;quot;typeCreationState&amp;quot; type=&amp;quot;tns:TypeCreationState&amp;quot; /&amp;gt;&lt;br&gt;  &amp;lt;element name=&amp;quot;typeUpdateState&amp;quot; type=&amp;quot;tns:TypeUpdateState&amp;quot; /&amp;gt;&lt;br&gt;  &amp;lt;element name=&amp;quot;typeChanges&amp;quot; type=&amp;quot;tns:TypeChanges&amp;quot; /&amp;gt;&lt;p&gt;  &amp;lt;!-- optional properties for Type as element group --&amp;gt;&lt;br&gt;  &amp;lt;group name=&amp;quot;Type_optional_properties&amp;quot;&amp;gt;&lt;br&gt;    &amp;lt;sequence&amp;gt;&lt;br&gt;      &amp;lt;element name=&amp;quot;prop3&amp;quot; type=&amp;quot;string&amp;quot; minOccurs=&amp;quot;0&amp;quot; maxOccurs=&amp;quot;1&amp;quot; /&amp;gt;&lt;br&gt;      &amp;lt;element name=&amp;quot;prop4&amp;quot; type=&amp;quot;int&amp;quot; minOccurs=&amp;quot;0&amp;quot; maxOccurs=&amp;quot;1&amp;quot; /&amp;gt;&lt;br&gt;    &amp;lt;/sequence&amp;gt;&lt;br&gt;  &amp;lt;/group&amp;gt;&lt;p&gt;  &amp;lt;complexType name=&amp;quot;TypeStateBase&amp;quot; abstract=&amp;quot;true&amp;quot; block=&amp;quot;#all&amp;quot;&amp;gt;&lt;br&gt;    &amp;lt;sequence&amp;gt;&lt;br&gt;      &amp;lt;!-- required properties, defined as optional --&amp;gt;&lt;br&gt;      &amp;lt;element name=&amp;quot;prop1&amp;quot; type=&amp;quot;string&amp;quot; minOccurs=&amp;quot;0&amp;quot; /&amp;gt;&lt;br&gt;      &amp;lt;element name=&amp;quot;prop2&amp;quot; type=&amp;quot;int&amp;quot; minOccurs=&amp;quot;0&amp;quot; /&amp;gt;&lt;br&gt;      &amp;lt;!-- optional properties --&amp;gt;&lt;br&gt;      &amp;lt;group ref=&amp;quot;tns:Type_optional_properties&amp;quot; /&amp;gt;&lt;br&gt;    &amp;lt;/sequence&amp;gt;&lt;br&gt;  &amp;lt;/complexType&amp;gt;&lt;p&gt;  &amp;lt;complexType name=&amp;quot;TypeCreationState&amp;quot;&amp;gt;&lt;br&gt;    &amp;lt;complexContent&amp;gt;&lt;br&gt;      &amp;lt;restriction base=&amp;quot;tns:TypeStateBase&amp;quot;&amp;gt;&lt;br&gt;        &amp;lt;sequence&amp;gt;&lt;br&gt;          &amp;lt;!-- required properties, re-defined as required --&amp;gt;&lt;br&gt;          &amp;lt;element name=&amp;quot;prop1&amp;quot; type=&amp;quot;string&amp;quot; /&amp;gt;&lt;br&gt;          &amp;lt;element name=&amp;quot;prop2&amp;quot; type=&amp;quot;int&amp;quot; /&amp;gt;&lt;br&gt;          &amp;lt;!-- optional properties --&amp;gt;&lt;br&gt;          &amp;lt;group ref=&amp;quot;tns:Type_optional_properties&amp;quot; /&amp;gt;&lt;br&gt;        &amp;lt;/sequence&amp;gt;&lt;br&gt;      &amp;lt;/restriction&amp;gt;&lt;br&gt;    &amp;lt;/complexContent&amp;gt;&lt;br&gt;  &amp;lt;/complexType&amp;gt;&lt;p&gt;  &amp;lt;complexType name=&amp;quot;TypeUpdateState&amp;quot;&amp;gt;&lt;br&gt;    &amp;lt;complexContent&amp;gt;&lt;br&gt;      &amp;lt;extension base=&amp;quot;tns:TypeCreationState&amp;quot;&amp;gt;&lt;br&gt;        &amp;lt;!-- id, version --&amp;gt;&lt;br&gt;        &amp;lt;attributeGroup ref=&amp;quot;tns:id_version&amp;quot; /&amp;gt;&lt;br&gt;      &amp;lt;/extension&amp;gt;&lt;br&gt;    &amp;lt;/complexContent&amp;gt;&lt;br&gt;  &amp;lt;/complexType&amp;gt;&lt;p&gt;  &amp;lt;complexType name=&amp;quot;Type&amp;quot;&amp;gt;&lt;br&gt;    &amp;lt;complexContent&amp;gt;&lt;br&gt;      &amp;lt;extension base=&amp;quot;tns:TypeUpdateState&amp;quot;&amp;gt;&lt;br&gt;        &amp;lt;!-- creationDate, deletionDate --&amp;gt;&lt;br&gt;        &amp;lt;attributeGroup ref=&amp;quot;tns:creationDate_deletionDate&amp;quot; /&amp;gt;&lt;br&gt;      &amp;lt;/extension&amp;gt;&lt;br&gt;    &amp;lt;/complexContent&amp;gt;&lt;br&gt;  &amp;lt;/complexType&amp;gt;&lt;p&gt;  &amp;lt;complexType name=&amp;quot;TypeChanges&amp;quot;&amp;gt;&lt;br&gt;    &amp;lt;complexContent&amp;gt;&lt;br&gt;      &amp;lt;extension base=&amp;quot;tns:TypeStateBase&amp;quot;&amp;gt;&lt;br&gt;        &amp;lt;!-- id, version --&amp;gt;&lt;br&gt;        &amp;lt;attributeGroup ref=&amp;quot;tns:id_version&amp;quot; /&amp;gt;&lt;br&gt;      &amp;lt;/extension&amp;gt;&lt;br&gt;    &amp;lt;/complexContent&amp;gt;&lt;br&gt;  &amp;lt;/complexType&amp;gt;&lt;p&gt;&amp;lt;/schema&amp;gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28828664-4020378523859998398?l=www.gerald-loeffler.net%2Fnotebook%2Findex.html' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28828664/posts/default/4020378523859998398'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28828664/posts/default/4020378523859998398'/><link rel='alternate' type='text/html' href='http://www.gerald-loeffler.net/notebook/index.html#4020378523859998398' title='XSD for XML messages for CRUD operations'/><author><name>Gerald Loeffler</name><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='03181935375336126302'/></author></entry><entry><id>tag:blogger.com,1999:blog-28828664.post-116508149278794849</id><published>2006-12-02T17:44:00.000Z</published><updated>2006-12-02T17:51:17.223Z</updated><title type='text'>Wildcards in Generics</title><content type='html'>Let GenB be a supertype of GenA and T a supertype of S:&lt;br /&gt;&lt;br /&gt;GenB&amp;lt;? extends T&amp;gt;, e.g. Collection&amp;lt;? extends Number&amp;gt;&lt;br /&gt; &lt;ul&gt;&lt;li&gt;is a supertype of GenA&amp;lt;S&amp;gt;, e.g. List&amp;lt;Integer&amp;gt;&lt;/li&gt;  &lt;li&gt;cannot put anything into such a type except null&lt;/li&gt;&lt;/ul&gt;GenB&amp;lt;? super S&amp;gt;, e.g. Collection&amp;lt;? super Integer&amp;gt;&lt;br /&gt; &lt;ul&gt;&lt;li&gt;is a supertype of GenA&amp;lt;T&amp;gt;, e.g. List&amp;lt;Number&amp;gt;&lt;/li&gt;  &lt;li&gt;cannot get anything out of such a type except Object&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28828664-116508149278794849?l=www.gerald-loeffler.net%2Fnotebook%2Findex.html' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28828664/posts/default/116508149278794849'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28828664/posts/default/116508149278794849'/><link rel='alternate' type='text/html' href='http://www.gerald-loeffler.net/notebook/index.html#116508149278794849' title='Wildcards in Generics'/><author><name>Gerald Loeffler</name><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='03181935375336126302'/></author></entry><entry><id>tag:blogger.com,1999:blog-28828664.post-114874275812962790</id><published>2006-05-27T15:04:00.000+01:00</published><updated>2006-05-27T16:51:43.020+01:00</updated><title type='text'>WSDL and JAX-WS 2.0 implementation</title><content type='html'>To write a WSDL that is&lt;br /&gt;&lt;ul&gt;&lt;li&gt;WS-I basic profile conformant&lt;/li&gt;&lt;li&gt;well-behaved for implementation in Java (tested with JAX-WS 2.0) and consumption through .Net (in both cases in terms of generated artefact (package, class, method) names)&lt;/li&gt;&lt;li&gt;document/literal/wrapped&lt;/li&gt;&lt;li&gt;suited to define webservice operations to accept/return XML types defined by external XML schema documents (like UBL or xAL)&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Basic WSDL (file MODULE_NAME.wsdl):&lt;br /&gt;--------------------------------------------------------&lt;pre&gt;&lt;br /&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;definitions&lt;br /&gt;  targetNamespace="NS_URI"&lt;br /&gt;  xmlns="http://schemas.xmlsoap.org/wsdl/"&lt;br /&gt;  xmlns:NS_NAME="NS_URI"&lt;br /&gt;  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"&amp;gt;&lt;br /&gt;  &lt;br /&gt;  &amp;lt;documentation&amp;gt;&lt;br /&gt;    $Id$&lt;br /&gt;    author: Gerald Loeffler&lt;br /&gt;  &amp;lt;/documentation&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;types&amp;gt;&lt;br /&gt;    &amp;lt;schema elementFormDefault="qualified"&lt;br /&gt;      targetNamespace="NS_URI"&lt;br /&gt;      xmlns="http://www.w3.org/2001/XMLSchema"&lt;br /&gt;   xmlns:NS_EXT_NAME="NS_EXT_URI"&amp;gt;&lt;br /&gt;&lt;br /&gt;   &amp;lt;import namespace="NS_EXT_URI"" schemaLocation="...location of XSD file..." /&amp;gt;&lt;br /&gt;&lt;br /&gt;      &amp;lt;element name="isAlive"&amp;gt;&lt;br /&gt;        &amp;lt;complexType /&amp;gt;&lt;br /&gt;      &amp;lt;/element&amp;gt;&lt;br /&gt;      &amp;lt;element name="isAliveResponse"&amp;gt;&lt;br /&gt;        &amp;lt;complexType&amp;gt;&lt;br /&gt;          &amp;lt;sequence&amp;gt;&lt;br /&gt;            &amp;lt;element name="return" type="boolean" /&amp;gt;&lt;br /&gt;          &amp;lt;/sequence&amp;gt;&lt;br /&gt;        &amp;lt;/complexType&amp;gt;&lt;br /&gt;      &amp;lt;/element&amp;gt;&lt;br /&gt;    &amp;lt;/schema&amp;gt;&lt;br /&gt;  &amp;lt;/types&amp;gt;&lt;br /&gt;  &lt;br /&gt;  &amp;lt;message name="isAliveIn"&amp;gt;&lt;br /&gt;    &amp;lt;part name="parameters" element="NS_NAME:isAlive" /&amp;gt;&lt;br /&gt;  &amp;lt;/message&amp;gt;&lt;br /&gt;  &amp;lt;message name="isAliveOut"&amp;gt;&lt;br /&gt;    &amp;lt;part name="parameters" element="NS_NAME:isAliveResponse" /&amp;gt;&lt;br /&gt;  &amp;lt;/message&amp;gt;&lt;br /&gt;  &amp;lt;portType name="ServiceWS"&amp;gt;&lt;br /&gt;    &amp;lt;operation name="isAlive"&amp;gt;&lt;br /&gt;      &amp;lt;input message="NS_NAME:isAliveIn" /&amp;gt;&lt;br /&gt;      &amp;lt;output message="NS_NAME:isAliveOut" /&amp;gt;&lt;br /&gt;    &amp;lt;/operation&amp;gt;&lt;br /&gt;  &amp;lt;/portType&amp;gt;&lt;br /&gt;  &amp;lt;binding name="ServiceSOAP11Binding" type="NS_NAME:ServiceWS"&amp;gt;&lt;br /&gt;    &amp;lt;soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /&amp;gt;&lt;br /&gt;    &amp;lt;operation name="isAlive"&amp;gt;&lt;br /&gt;      &amp;lt;soap:operation soapAction="" /&amp;gt;&lt;br /&gt;      &amp;lt;input&amp;gt;&amp;lt;soap:body use="literal" /&amp;gt;&amp;lt;/input&amp;gt;&lt;br /&gt;      &amp;lt;output&amp;gt;&amp;lt;soap:body use="literal" /&amp;gt;&amp;lt;/output&amp;gt;&lt;br /&gt;    &amp;lt;/operation&amp;gt;&lt;br /&gt;  &amp;lt;/binding&amp;gt;&lt;br /&gt;  &lt;br /&gt;  &amp;lt;service name="Service"&amp;gt;&lt;br /&gt;    &amp;lt;port name="ServiceSOAP11Port" binding="NS_NAME:ServiceSOAP11Binding"&amp;gt;&lt;br /&gt;      &amp;lt;soap:address location="REPLACE_WITH_ACTUAL_URL" /&amp;gt;&lt;br /&gt;    &amp;lt;/port&amp;gt;&lt;br /&gt;  &amp;lt;/service&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/definitions&amp;gt;&lt;/pre&gt;&lt;br /&gt;--------------------------------------------------------&lt;br /&gt;This includes a webservice operation called "isAlive" (in the generated Java interface "ServiceWS") that can be used for health checks.&lt;br /&gt;&lt;br /&gt;To add a webservice operation to this WSDL:&lt;br /&gt;&lt;br /&gt;1. in WSDL types/schema section&lt;br /&gt;--------------------------------------------------------&lt;pre&gt;&lt;br /&gt;      &amp;lt;element name="METHOD_NAME"&amp;gt;&lt;br /&gt;        &amp;lt;complexType&amp;gt;&lt;br /&gt;          &amp;lt;sequence&amp;gt;&lt;br /&gt;            &amp;lt;element name="..." type="NS_EXT_NAME:...some external XML type..." /&amp;gt;&lt;br /&gt;          &amp;lt;/sequence&amp;gt;&lt;br /&gt;        &amp;lt;/complexType&amp;gt;&lt;br /&gt;      &amp;lt;/element&amp;gt;&lt;br /&gt;      &amp;lt;element name="METHOD_NAMEResponse"&amp;gt;&lt;br /&gt;        &amp;lt;complexType&amp;gt;&lt;br /&gt;          &amp;lt;sequence&amp;gt;&lt;br /&gt;            &amp;lt;element name="return" type="NS_EXT_NAME:...some external XML type..." /&amp;gt;&lt;br /&gt;          &amp;lt;/sequence&amp;gt;&lt;br /&gt;        &amp;lt;/complexType&amp;gt;&lt;br /&gt;      &amp;lt;/element&amp;gt;&lt;/pre&gt;&lt;br /&gt;--------------------------------------------------------&lt;br /&gt;2. messages&lt;br /&gt;--------------------------------------------------------&lt;pre&gt;&lt;br /&gt;  &amp;lt;message name="METHOD_NAMEIn"&amp;gt;&lt;br /&gt;    &amp;lt;part name="parameters" element="NS_NAME:METHOD_NAME" /&amp;gt;&lt;br /&gt;  &amp;lt;/message&amp;gt;&lt;br /&gt;  &amp;lt;message name="METHOD_NAMEOut"&amp;gt;&lt;br /&gt;    &amp;lt;part name="parameters" element="NS_NAME:METHOD_NAMEResponse" /&amp;gt;&lt;br /&gt;  &amp;lt;/message&amp;gt;&lt;/pre&gt;&lt;br /&gt;--------------------------------------------------------&lt;br /&gt;3. porttype&lt;br /&gt;--------------------------------------------------------&lt;pre&gt;&lt;br /&gt;  &amp;lt;portType name="CLASS_NAMEWS"&amp;gt;&lt;br /&gt;    &amp;lt;operation name="METHOD_NAME"&amp;gt;&lt;br /&gt;      &amp;lt;input message="NS_NAME:METHOD_NAMEIn" /&amp;gt;&lt;br /&gt;      &amp;lt;output message="NS_NAME:METHOD_NAMEOut" /&amp;gt;&lt;br /&gt;    &amp;lt;/operation&amp;gt;&lt;br /&gt;  &amp;lt;/portType&amp;gt;&lt;/pre&gt;&lt;br /&gt;--------------------------------------------------------&lt;br /&gt;4. binding&lt;br /&gt;--------------------------------------------------------&lt;pre&gt;&lt;br /&gt;  &amp;lt;binding name="CLASS_NAMESOAP11Binding" type="NS_NAME:CLASS_NAMEWS"&amp;gt;&lt;br /&gt;    &amp;lt;soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /&amp;gt;&lt;br /&gt;    &amp;lt;operation name="METHOD_NAME"&amp;gt;&lt;br /&gt;      &amp;lt;soap:operation soapAction="" /&amp;gt;&lt;br /&gt;      &amp;lt;input&amp;gt;&amp;lt;soap:body use="literal" /&amp;gt;&amp;lt;/input&amp;gt;&lt;br /&gt;      &amp;lt;output&amp;gt;&amp;lt;soap:body use="literal" /&amp;gt;&amp;lt;/output&amp;gt;&lt;br /&gt;    &amp;lt;/operation&amp;gt;&lt;br /&gt;  &amp;lt;/binding&amp;gt;&lt;/pre&gt;&lt;br /&gt;--------------------------------------------------------&lt;br /&gt;5. service&lt;br /&gt;--------------------------------------------------------&lt;pre&gt;&lt;br /&gt;  &amp;lt;service name="Service"&amp;gt;&lt;br /&gt;    &amp;lt;port name="CLASS_NAMESOAP11Port" binding="NS_NAME:CLASS_NAMESOAP11Binding"&amp;gt;&lt;br /&gt;      &amp;lt;soap:address location="REPLACE_WITH_ACTUAL_URL" /&amp;gt;&lt;br /&gt;    &amp;lt;/port&amp;gt;&lt;br /&gt;  &amp;lt;/service&amp;gt;&lt;/pre&gt;&lt;br /&gt;--------------------------------------------------------&lt;br /&gt;Tokens to replace in all these templates:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;MODULE_NAME: the name of the webservice module = the base name of the WSDL document, e.g. "core"&lt;br /&gt;&lt;/li&gt;&lt;li&gt;NS_NAME: XML namespace name for this webservice module, e.g. "foowsc"&lt;/li&gt;&lt;li&gt;NS_URI: URI for the XML namespace with name NS_NAME, e.g. "urn:com:foo:webservice:MODULE_NAME". JAX-WS will generate the artefacts for this WSDL in a Java package with a very similar name, e.g. "com.foo.webservice.MODULE_NAME".&lt;/li&gt;&lt;li&gt;NS_EXT_NAME: XML namespace name for an external XML schema document defining the XML types transported (as arguments and/or return types) by the webservice operation, e.g. "fooxtc"&lt;/li&gt;&lt;li&gt;NS_EXT_URI: URI for the XML namespace with name NS_EXT_NAME, e.g. "urn:com:foo:xmltype:core".&lt;/li&gt;&lt;li&gt;CLASS_NAME: name of the class that the webservice operation logically belongs to, e.g. "Person". The name of the Java interface generated by JAX-WS will be this name plus "WS", e.g. "PersonWS".&lt;/li&gt;&lt;li&gt;METHOD_NAME: name of the webservice operation, e.g. "getPersonsByLastName". JAX-WS will add a method with this name to the generated interface (e.g. "PersonWS").&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;To implement the webservice operations generated by JAX-WS:&lt;br /&gt;--------------------------------------------------------&lt;pre&gt;&lt;br /&gt;package com.foo.webservice.MODULE_NAME.impl;&lt;br /&gt;&lt;br /&gt;@WebService(targetNamespace = "NS_URI", serviceName = "Service", endpointInterface = "com.foo.webservice.MODULE_NAME.CLASS_NAMEWS")&lt;br /&gt;public class CLASS_NAMEWSImpl implements CLASS_NAMEWS {&lt;br /&gt;  //...&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;--------------------------------------------------------&lt;br /&gt;and in sun-jaxws.xml:&lt;br /&gt;--------------------------------------------------------&lt;pre&gt;&lt;br /&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;br /&gt;&amp;lt;!--&lt;br /&gt;  $Id$&lt;br /&gt;  author: Gerald Loeffler&lt;br /&gt;--&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;endpoints version="2.0"&lt;br /&gt;  xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime"&amp;gt;&lt;br /&gt; &amp;lt;endpoint &lt;br /&gt;   name="/MODULE_NAME/Service" &lt;br /&gt;   pattern="/MODULE_NAME/Service" &lt;br /&gt;   wsdl="WEB-INF/wsdl/MODULE_NAME.wsdl" &lt;br /&gt;   implementation="com.foo.webservice.MODULE_NAME.impl.ServiceWSImpl"&lt;br /&gt;   port="{urn:com:foo:webservice:MODULE_NAME}ServiceSOAP11Port" /&amp;gt;&lt;br /&gt; &amp;lt;endpoint &lt;br /&gt;   name="/MODULE_NAME/CLASS_NAME" &lt;br /&gt;   pattern="/MODULE_NAME/CLASS_NAME" &lt;br /&gt;   wsdl="WEB-INF/wsdl/MODULE_NAME.wsdl" &lt;br /&gt;   implementation="com.foo.webservice.MODULE_NAME.impl.CLASS_NAMEWSImpl"&lt;br /&gt;   port="{urn:com:foo:webservice:MODULE_NAME}CLASS_NAMESOAP11Port"/&amp;gt;&lt;br /&gt; ...&lt;br /&gt;&amp;lt;/endpoints&amp;gt;&lt;/pre&gt;&lt;br /&gt;--------------------------------------------------------&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28828664-114874275812962790?l=www.gerald-loeffler.net%2Fnotebook%2Findex.html' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28828664/posts/default/114874275812962790'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28828664/posts/default/114874275812962790'/><link rel='alternate' type='text/html' href='http://www.gerald-loeffler.net/notebook/index.html#114874275812962790' title='WSDL and JAX-WS 2.0 implementation'/><author><name>Gerald Loeffler</name><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='03181935375336126302'/></author></entry></feed>