anchor.diff:  === Session attribute marshalling
   
   Minimizing the replication/persistence payload for individual session attributes has a direct impact on performance by reducing the number of bytes sent over the network or persisted to storage.
  -A web application can optimize the marshalling of a given session attribute, either through custom JDK serialization logic, or by implementing a custom externalizer.
  +
  +==== JBoss Marshalling
  +
  +https://jbossmarshalling.jboss.org/[JBoss Marshalling] is a serialization library for objects implementing `java.io.Serializable`.
  +
  +When configured to use JBoss Marshalling, a web application can optimize the marshalling of a given session attribute, either through custom JDK serialization logic, or by implementing a custom externalizer.
   An externalizer is an implementation of the `org.wildfly.clustering.marshalling.Externalizer` interface, which dictates how a given class should be marshalled.
   An externalizer reads/writes the state of an object directly from/to an input/output stream, but also:
   
  
positive.code: ATTRIBUTE:::
  Stores each session attribute within a separate cache entry.
  This is generally more efficient than SESSION granularity, but does not preserve any cross-attribute object references.
  
  affinity::
  This resource defines the affinity that a web request should have for a given server.
  The affinity of the associated web session determines the algorithm for generating the route to be appended onto the session ID (within the JSESSIONID cookie, or when encoding URLs).
  
negative.code: Externalizers are dynamically loaded during deployment via the service loader mechanism.
  Implementations should be enumerated within a file named:
  `/META-INF/services/org.wildfly.clustering.marshalling.Externalizer`
  
  ==== ProtoStream
  
  https://github.com/infinispan/protostream[ProtoStream] is serialization library based on the https://developers.google.com/protocol-buffers[Protobuf] data format.
  The nature of the Protobuf data format makes it very easy to evolve classes without breaking serialization compatibility.
  When compared to JBoss Marshalling, ProtoStream is generally more efficient and generates smaller payloads, especially for objects containing fields that are either optional or have a default value.
  Since marshallable classes are explicitly enumerated, ProtoStream is not vulnerable to the same arbitrary code execution exploits that affect JDK serialization.
  
  When configured to use ProtoStream, a web application will need to register ProtoStream marshallers/schemas for any session attribute of a custom type.
  WildFly initializes its ProtoStream marshaller using all instances of `org.infinispan.protostream.SerializationContextInitializer` visible to the deployment classpath.
  Implementations should be enumerated within a file named:
  `/META-INF/services/org.infinispan.protostream.SerializationContextInitializer`
  
  Simple objects can leverage ProtoStream annotations and https://infinispan.org/docs/stable/titles/encoding/encoding.html#adding-protostream-processor_marshalling[auto-generate marshallers and schemas at build time].
  
  e.g.
  [source,java]
  ----
  @AutoProtoSchemaBuilder(includeClasses = { Person.class })
  public interface PersonInitalizer extends SerializationContextInitializer {
  }
  
  public class Person {
      @ProtoField(number = 1)
      final String name;
      @ProtoField(number = 2, type = Type.UINT32, defaultValue = "0")
      final int age;
      @ProtoField(number = 3)
      Person parent;
      @ProtoField(number = 4, collectionImplementation = LinkedList.class)
      final List<Person> children;
  
      @ProtoFactory
      Person(String name, int age, Person parent, List<Person> children) {
          this.name = name;
          this.age = age;
          this.parent = parent;
          this.children = children;
      }
  
      public Person(String name, int age) {
          this.name = name;
          this.age = age;
          this.children = new LinkedList<>();
      }
  
      public String getName() {
          return this.name;
      }
  
      public int getAge() {
          return this.age;
      }
  
      public Person getParent() {
          return this.parent;
      }
  
      public List<Person> getChildren() {
          return this.children;
      }
  
      public void setParent(Person parent) {
          this.parent = parent;
      }
  
      public void addChild(Person child) {
          this.children.add(child);
      }
  }
  ----
  
  Sufficiently complex objects may require a custom `org.infinispan.protostream.SerializationContextInitializer` implementation to register custom marshaller implementations and schemas.
  Refer to the https://infinispan.org/docs/stable/titles/encoding/encoding.html#marshalling_user_types[Infinispan documentation] for details.
  