de.netseeker.ejoe
Class EJServer

java.lang.Object
  extended byde.netseeker.ejoe.EJServer

public class EJServer
extends java.lang.Object

This is the server component of EJOE. EJOE is a request object broker in it's natural meaning. You have to use this component if you want retrieve and send data from/to EJOE clients. EJOE offers three things - and ONLY these three things for you:

  1. a multithreaded, high performance io server
  2. (de)serializing input of input objects send by clients and return objects provided by YOUR business logic
  3. a simple, clean and unique interface to integrate a object request broker into your application

Author:
netseeker aka Michael Manske

Field Summary
static int CON_USE_COMPRESSION
           
static int CON_USE_NONBLOCKING_IO
           
static int CON_USE_PERSISTENT
           
 
Constructor Summary
EJServer(int options, ServerHandler handler)
          Creates an instance of the EJOE server component pre-configured whith a default value for the used port and using the given connection options.
EJServer(int options, ServerHandler handler, int port)
          Creates an instance of the EJOE server component pre-configured whith the default (de)serializing mechanism and using the given connection options.
EJServer(ServerHandler handler)
          Creates an instance of the EJOE server component pre-configured whith a default value for the used port
EJServer(ServerHandler handler, int port)
          Creates an instance of the EJOE server component
 
Method Summary
 void enableCompression(boolean enable)
          Enables or disables the usage of compressing/decompressing for outgoing/incoming data.
 void enableCompression(int compressionLevel)
          Enables the usage of compressing/decompressing for outgoing/incoming data with the given compression level.
 void enableNonBlockingIO(boolean enable)
          Enables/disables new style non-blocking IO for read and write operations.
 void enablePersistentConnections(boolean enable)
          Enables/disables support for persistents client connections.
 void enableRemoteClassLoading(boolean enable)
          Enables support for remote classloading via a second EJOE instance using a default port and a special ServerHandler for class loading requests.
 void enableRemoteClassLoading(int port)
          Enables support for remote classloading via a second EJOE instance using a special ServerHandler for class loading requests.
 void enableThreadedProcessorUsage(boolean enable)
          Enables the threaded processor feature.
 void setMaxReadProcessors(int maxProcessors)
          Sets the amount of threads used for processing read operations on accepted connections.
 void setMaxWriteProcessors(int maxProcessors)
          Sets the amount of threads used for processing write operations.
 void start()
          (Re)Starts the main server as well as the class loader server (if it's configured)
 void stop()
          Stops the main server as well as the class loader server (if it's running)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CON_USE_COMPRESSION

public static final int CON_USE_COMPRESSION
See Also:
Constant Field Values

CON_USE_NONBLOCKING_IO

public static final int CON_USE_NONBLOCKING_IO
See Also:
Constant Field Values

CON_USE_PERSISTENT

public static final int CON_USE_PERSISTENT
See Also:
Constant Field Values
Constructor Detail

EJServer

public EJServer(ServerHandler handler)
Creates an instance of the EJOE server component pre-configured whith a default value for the used port

Parameters:
handler - an implementation of de.netseeker.ejoe.ServerHandler

EJServer

public EJServer(ServerHandler handler,
                int port)
Creates an instance of the EJOE server component

Parameters:
handler - an implementation of de.netseeker.ejoe.ServerHandler
port - the port EJOE should listen to

EJServer

public EJServer(int options,
                ServerHandler handler)
Creates an instance of the EJOE server component pre-configured whith a default value for the used port and using the given connection options.

Parameters:
options - the options to use
handler - an implementation of de.netseeker.ejoe.ServerHandler
See Also:
CON_USE_COMPRESSION, CON_USE_NONBLOCKING_IO, CON_USE_PERSISTENT

EJServer

public EJServer(int options,
                ServerHandler handler,
                int port)
Creates an instance of the EJOE server component pre-configured whith the default (de)serializing mechanism and using the given connection options.

Parameters:
options - the options to use
handler - an implementation of de.netseeker.ejoe.ServerHandler
port - the port EJOE should listen to
See Also:
CON_USE_COMPRESSION, CON_USE_NONBLOCKING_IO, CON_USE_PERSISTENT
Method Detail

setMaxReadProcessors

public void setMaxReadProcessors(int maxProcessors)
Sets the amount of threads used for processing read operations on accepted connections. This will indirectly control the amount of concurrently processed io read operations and adapter calls.

Parameters:
maxProcessors - new amount of threads used for processing accepted connections
See Also:
setMaxWriteProcessors(int)

setMaxWriteProcessors

public void setMaxWriteProcessors(int maxProcessors)
Sets the amount of threads used for processing write operations. This will directly control the amount of concurrently processed io socket write operations.

Parameters:
maxProcessors - new amount of threads used for processing io socket write operations
See Also:
setMaxReadProcessors(int)

enableThreadedProcessorUsage

public void enableThreadedProcessorUsage(boolean enable)
Enables the threaded processor feature. This means that for each incoming connection a new server thread will be started which will be responsible for processing read operations as well as invocation of the used ServerHandler. Unlike the default behavior (when a limited threadpool is used) the use of threaded processors will block as long as the amount of open processor threads is greater than or equal the max. processor limit. Enabling this feature *can* reduce cpu and memory consumption, especially if the server handler tasks are long time tasks or very resource hungry. It's strongly recommended to try different settings for the maximum of used processor threads to achieve best possible performance when enabling threaded processors.

See Also:
#setMaxProcessors(int)

enableCompression

public void enableCompression(boolean enable)
Enables or disables the usage of compressing/decompressing for outgoing/incoming data. Enabling compression *can* result in signifcantly better throughput especially when using a text based SerializeAdapter in confunction with large data objects.

See Also:
SerializeAdapter

enableCompression

public void enableCompression(int compressionLevel)
Enables the usage of compressing/decompressing for outgoing/incoming data with the given compression level. Enabling compression *can* result in signifcantly better throughput especially when using a text based SerializeAdapter in confunction with large data objects.

Parameters:
compressionLevel - the level of compression to use, must be in range of 0-9
See Also:
SerializeAdapter

enableNonBlockingIO

public void enableNonBlockingIO(boolean enable)
Enables/disables new style non-blocking IO for read and write operations. Sometimes this can be significantly faster than using blocking io. Be aware that connection acception as well as EJOES internal connection handshaking will use NIO anyway to ensure high latency.


enablePersistentConnections

public void enablePersistentConnections(boolean enable)
Enables/disables support for persistents client connections. Usage of persistent connections is more performant in most cases because the client doesn't need to open a new connection on each request. The drawback of persistent connections can be a higher server load because the server may have to handle a lot of "idle" client connections.

Parameters:
enable -

enableRemoteClassLoading

public void enableRemoteClassLoading(boolean enable)
Enables support for remote classloading via a second EJOE instance using a default port and a special ServerHandler for class loading requests.


enableRemoteClassLoading

public void enableRemoteClassLoading(int port)
Enables support for remote classloading via a second EJOE instance using a special ServerHandler for class loading requests.

Parameters:
port - The port which the class loader server should use

start

public void start()
           throws java.io.IOException
(Re)Starts the main server as well as the class loader server (if it's configured)

Throws:
java.io.IOException

stop

public void stop()
Stops the main server as well as the class loader server (if it's running)



Copyright © 2005-2006 netseeker. All Rights Reserved.