Skip to Content

Java development guidelines

Printer-friendly versionSend to friendPDF version
Intermediate
This article provides the basic guidelines in terms of Java coding within a Rich Media Streamezzo Page (RSP).

HTTP Session usage

Make session stored objects serializable

All objects supposed to be stored in session MUST implement the Serializable interface.

Keep Session attributes as light as possible

For performances and scalability reasons, the total size of attributes stored in the HTTP session may not be over 10 Kbytes.

Beware of loosing session data

Sessions are volatile, as session data will be lost when the session expires. As a consequence you have to make sure that important data (i.e. vital for the rich media service to be properly rendered) is not stored in session, and this data is backed up elsewhere. Sessions are best used for storing temporary information that can be lost, or retrieved from another storage.


Concurrency considerations

The same RSP code will be used to answer several client requests at the same time. Therefore, the developer may not use members in a RSP that can be modified at runtime.


Optimal code performance

Code performance is an issue that has to be looked at when it comes to rich media service scalability. For example, it might be wise to wonder if all of the computing has to be done at runtime for each request.


Optimal memory usage

Memory usage is a sensitive issue for service scalability. It is not recommended to mount heavy objects or huge data in memory: prefer streams usage.


Logs

The Service APIs offers logging facilities that can be used for any logging of the service.

Use service logger instead of system output

Avoid using "System.out" to trace information. The use of the service logger will allow service tuning at runtime.

Make use of log levels

Using appropriately the severity levels will ease activating / deactivating logs according to the level of information your need to be traced. This will especially enable to trace all possible logs when in development or debugging phase, and ensure only critical logs are traced when your rich media service is in production, in order not to impact server performances.
Five standard levels of log are provided within the service logger:

  • debug
  • info
  • warn
  • error
  • fatal
Share this