Custom ServerHandler

If reflection is to slow, unsafe or just inappropriate then a custom ServerHandler could be the solution.

EJOE makes only two demands on a custom ServerHandler:

  1. ServerHandlers must implement de.netseeker.ejoe.handler.ServerHandler
  2. ServerHandlers must be threadsafe
EJOE uses ServerHandlers like singletons. There can exist only one instance of a ServerHandler within EJOE. A ServerHandler should not use synchronization (especially not method-wide), because this would effective affect EJOEs multithreading!
package de.netseeker.ejoe.handler;
/**
* Simple interface defining the entry point for all server handlers.
* Server handlers are the working horses which the caller must implement.
* Server handlers take the transported input objects send by the client
* application and return none, one or more return values.
*
* @author netseeker aka Michael Manske
* @since 0.3.0
*/
public interface ServerHandler
{
	/**
	* Handles a client request
	*
	* @param obj The input object transported by EJOE
	* @return null or a valid return value. If you want return custom datatypes,
	* eg. Your own beans and do not want (or not be able) to deploy the classes of
	* these datatypes on the client, you can turn on EJOEs remote classloading feature.
	*/
	public Object handle( Object obj ) throws Exception;
}