Java IDL: Developing Servers

# Developing Servers

This document was not updated for the J2SETM release. If you downloaded this document as part of the J2SETM documentation bundle, check the Web site at http://java.sun.com/j2se/1.4/docs/guide/idl/jidlServers.html for updates.

This topic introduces Java IDL support for servers of both persistent and transient CORBA objects.

## Transient and Persistent Objects

A persistent CORBA object lives until it is explicitly destroyed. If a client has a reference to a persistent CORBA object, that reference can be used even if the object's server is not running -- an ORB daemon, ORBD, will start the server when the ORB receives an invocation on the object.

Starting with J2SE 1.4, Java IDL includes a Portable Object Adapter (POA), Object Request Broker Daemon (ORBD), and the `servertool`. These features enable persistent object servers to be written using Java IDL!

By contrast, a transient CORBA object has the same lifetime as the execution of the server process that creates it. When a server terminates, its transient objects disappear with it and any object references held by the client become invalid. Transient objects are often used to effect asynchronous, or callback communication between applications and objects. For example, suppose a timing service notifies a client application when an interval expires; it could do so as follows:

- The timing service defines an interface for a notifier object that includes an `interval_expired()` operation.

- The timing service requires that a client pass a notifier object to the timing service's `set_interval()` operation.

- The timing service client application implements a transient object that implements the notifier interface.

- The client application creates and passes a notifier object to the timing service.

- When the interval expires, the timing service invokes the notifier object's `interval_expired()` operation.

The arrangement, in other words, is much like a callback in procedural programming.

# Persistent Object Servers

Starting with J2SE 1.4, Java IDL includes a Portable Object Adapter (POA), Object Request Broker Daemon (ORBD), and the `servertool`. These features enable persistent object servers to be written using Java IDL! The tutorial Hello World with persistent server provides a version of the "Hello World" application that utilizes a persistent object server.

# Transient Object Servers

The Hello World example includes a transient object server.

Clients | Servers | Exceptions | Initialization | Naming

Home | Fundamentals | Programming | References | Tutorial

Copyright © 1996, 1997 Sun Microsystems, Inc., 2550 Garcia Ave., Mtn. View, CA. 94043-1100 USA., All rights reserved.