Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

Sponsored Links

Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs

J2SE 1.4 breathes new life into the CORBA community, Part 2

Gain code portability with the Portable Object Adapter

  • Print
  • Feedback

Page 4 of 5

  • Allocation of requests to threads (that is, multithreading)
  • CORBA object lifespan
  • Object identifiers
  • Mapping of objects to servants
  • Implicit versus explicit object activation
  • Servant retention
  • Mapping of request to servants


As in the code snippet shown above, you can create a POA without defining any policies; the default values will be used. In the example above, the RootPOA and POAs A, B, and C use the default policy values, defined below:

  • Allocation of requests to threads: ORB controlled
  • CORBA object lifespan: Transient
  • Object identifiers: System assigned
  • Mapping of objects to servants: Must be unique, that is, servants cannot be shared
  • Implicit versus explicit object activation: Explicit activation
  • Servant retention: Servants are retained
  • Mapping of request to servants: Only the active object map is used (more about the active object map later)


You can also fine-tune the policies for each POA to match your exact requirements. For example, recall that a POA can create either persistent or transient object references, but not both. The RootPOA can only create transient references, but you could create a new POA that can create persistent references. An example is shown below:

      .
      .
      .
      // rootPOA is a reference to the Root POA
      Policy[] policies = new Policy[1];
      policies[0] = rootPOA.create_lifespan_policy(LifespanPolicyValue.PERSISTENT); 
      POA A = rootPOA.create_POA("A",null,policies);
      .
      .
      .


This code differs from the earlier RootPOA creation in that instead of passing a null value as the third parameter in the create_POA() method, I pass in an array of Policy objects.

Now let's look at each policy more closely.

Allocation of requests to threads

This policy specifies the threading model used with the created POA. It can have the following values:

  • ORB_CTRL_MODEL: When this default value is specified, the ORB assigns ORB-controlled POA requests to threads.
  • SINGLE_THREAD_MODEL: Specifies that requests for a single-threaded POA process sequentially. Note: J2SE 1.4's ORB doesn't support this value.


CORBA object lifespan policy

This policy specifies the lifespan of the objects implemented in the created POA and can have the following values:

  • TRANSIENT: This default value specifies that the objects implemented in the POA cannot outlive the POA instance in which they were first created.
  • PERSISTENT: Specifies that the objects implemented in the POA can outlive the process in which they were first created.


Mapping of objects to servants

This policy specifies whether the servants activated in the created POA must have unique object identities. It can have the following values:

  • UNIQUE_ID: This default value specifies that servants activated with the created POA support exactly one object ID.
  • MULTIPLE_ID: Specifies that a servant activated with the created POA can support one or more object IDs. That means the same servant instance can incarnate multiple CORBA objects.


Object identifiers assignment policy

This policy specifies whether the application or the ORB generates the created POA's object IDs. This policy has the following values:

  • Print
  • Feedback

Resources