serialization strategies

A serialization strategy decides in which extent EJServer und EJClient will undertake the task of serialization.

default serialization

With default serialization enabled all objects will get serialized before they

  • will get send as request to the server
  • will get send as response to the client
and will get deserialized before they
  • will passed to the ServerHandler
  • will be returned to the the caller of EJClient
Both, client application and ServerHandler, does not notice anything about serialization. They do not have access to the serialized form of a object, neither to the serialized request nor to the serialized response. If no other serialize strategy was specified, default serialization will be active automatically. Default serialization is represented with the constant ADAPTER_STRATEGY_DEFAULT within the class de.netseeker.ejoe.EJConstants .
import de.netseeker.ejoe.EJClient;
import de.netseeker.ejoe.EJConstants;
...
	EJClient client = new EJClient(...);
	client.setAdapterStrategy( EJConstants. ADAPTER_STRATEGY_DEFAULT );
...

mixed serialization

EJClient offers the option to return the serialized form of a server response instead of deserialized responses. This makes sense if

  • the client application will store the response as serialized form, eg. within a database or as file.
  • the response will get post-worked by a post processor like a XSLT-prozessor, which is not able to work with deserialized objects
The mixed serialization strategy is represented with the constant ADAPTER_STRATEGY_MIXED within the class de.netseeker.ejoe.EJConstants .
import de.netseeker.ejoe.EJClient;
import de.netseeker.ejoe.EJConstants;
...
	EJClient client = new EJClient(...);
	client.setAdapterStrategy( EJConstants. ADAPTER_STRATEGY_MIXED );
...

direct exchange of ByteBuffers (java.nio.ByteBuffer)

If both, ServerHandler and client application, are able to handle requests and responses in the form of java.nio.ByteBuffer, it could make sense to disable serialization by EJOE. No serialization is required to exchange java.nio.ByteBuffer over netork.

The direct serialization strategy is represented with the constant ADAPTER_STRATEGY_DIRECT within the class de.netseeker.ejoe.EJConstants .

import de.netseeker.ejoe.EJClient;
import de.netseeker.ejoe.EJConstants;
...
	EJClient client = new EJClient(...);
	client.setAdapterStrategy( EJConstants. ADAPTER_STRATEGY_DIRECT );
...