[Previous] [Contents] [Next] [IONA Technologies]


Chapter 16
Configuring OrbixWeb through its API


Contents

16.1 Obtaining Initial References
16.2 Setting the OrbixWeb Daemon Internet Ports
16.3 Event Processing
16.4 Connection Establishment
16.4.1 Retry Attempts
16.5 Reconnecting to a Failed Server
16.6 Increasing Size of Internal Object Table
16.7 Collocation of Clients and Servers
16.7.1 Enforcing Collocation in an OrbixWeb Application
16.7.2 Testing for the Presence of Enforced Collocation
16.8 Testing for Existence of Server Object
16.9 Client Invocations Timing Out
16.10 Diagnostic Messages



This chapter outlines how a programmer may configure the actions of OrbixWeb, through the _CORBA.Orbix object (defined in package IE.Iona.Orbix2). By default, _CORBA.Orbix is an object of type BOA (defined in package IE.Iona.Orbix2.CORBA) which is necessary for the implementation of servers. As described in Chapter 3, "OrbixWeb Configuration" of the OrbixWeb Reference Guide, client programmers may chose to configure _CORBA.Orbix as an object of type ORB from which BOA inherits.

The acronym BOA stands for Basic Object Adapter. An Object Adapter is the CORBA term given to the environment in which server applications run. An object adapter provides services such as:

The BOA or Basic Object Adapter is an object adapter specified by CORBA which must be provided by every ORB. An ORB may optionally provide other object adapters and a server may support a number of object adapters to serve different types of requests.

An exhaustive listing of the API to both class ORB and class BOA is available in Part II, "Class and Interface Reference" of the OrbixWeb Reference Guide. The purpose of this chapter is to familiarise the reader with some of the elements of OrbixWeb made configurable by this API.

16.1 Obtaining Initial References

Some services and, in particular, the Interface Repository and the CORBAservices,1 can only be used by first obtaining an object reference to an object through which the service can be used. The Naming Service provides a general purpose facility for doing this, but of course some way then needs to be defined to obtain a reference to an initial naming context within which a name can be resolved.

CORBA addresses this difficulty by providing two operations in interface ORB. These provide the facilities of a simplified naming service, in which (flat, rather than hierarchical) names can be resolved to obtain initial references to important objects in the system:

OrbixWeb implements the operation resolve_initial_references(). The method which implements this operation is defined as follows:

Only a small group of names are understood by resolve_initial_references(). In fact, only the string "NameService" is currently supported. The operation resolve_initial_references() returns an Interoperable Object Reference (IOR), which must be converted to the correct object type.

16.2 Setting the OrbixWeb Daemon Internet Ports

In an application where an OrbixWeb daemon is required, when a client attempts to establish a connection to a server, it implicitly contacts the OrbixWeb daemon process at the server host. The daemon process awaits incoming client requests for server activation, launches servers as required, and binds the client to the correct server.

The daemon process awaits client requests using two well-known TCP/IP ports: one port is assigned to communications with clients using the Orbix protocol, the other to clients using IIOP. Before a client can contact a given OrbixWeb daemon, the client must be aware of the port value for that process for the required protocol.

By default, the daemon's Orbix protocol port is set to 1570, while its IIOP port is set to 1571. A client can update its settings for these values using one of the following methods:

In addition, the Orbix protocol port setting for a client can be updated at runtime by invoking the Java method ORB.setHostPort() with a new port number as parameter. The method ORB.getHostPort() can be invoked to retrieve a client's current Orbix protocol port setting.

16.3 Event Processing

Class BOA provides several event processing methods in addition to impl_is_ready(). These methods give a programmer more control over handling of server events such as operation requests, and connections and disconnections from clients.

The relevant methods are processNextEvent(), processEvents() and obj_is_ready(). A server can also test whether or not there is an outstanding event using isEventPending().

16.4 Connection Establishment

By default, there is a timeout of thirty seconds for establishing connection from a client to a server to confirm that both are operational. This timeout can be changed using the method ORB.connectionTimeOut().

Under some circumstances, connectionTimeOut() has no effect–for example, if the server's host is known but is down or unreachable, a TCP/IP connect can block for a considerable time depending on the target operating system.

16.4.1 Retry Attempts

If a connection cannot be made on the first attempt because the server cannot be contacted, OrbixWeb will retry the attempt every two seconds until either the call can be made or until there have been too many retries.

The method ORB.maxConnectRetries() can be used to set the maximum number of retries that should be attempted. The default number is ten.

16.5 Reconnecting to a Failed Server

When an OrbixWeb client first contacts a server, a single communication channel is established between the client-server pair. This connection is then used for all subsequent communications between the client and server. The connection is closed only when either client or server exits.

When a server exits while a client is still connected, the next invocation by the client will raise an OrbixWeb system exception of type COMM_FAILURE. If the client attempts another invocation, OrbixWeb will automatically try to re-establish the connection. This default behaviour can be changed using the function ORB.noReconnectOnFailure(), with a parameter value true.

In the non-default case, all client attempts to contact a server subsequent to closure of the communications channel will raise a COMM_FAILURE system exception.

16.6 Increasing Size of Internal Object Table

All the OrbixWeb objects in an application are registered in an internal object table–a hash table which maps from object identifiers to communication channels. It may be important that this table is not too small for the number of objects in the process, since long overflow chains lead to inefficiencies. The default size of the object table is 100.

If a programmer anticipates that a program will connect to a much larger number of objects than the default size, the method ORB.reSizeObjectTable() can be used to resize the table.

16.7 Collocation of Clients and Servers

For some applications, it is useful to use IDL to define the interfaces between objects, even if these objects are not distributed. Further, the objects of some applications may or may not be distributed, depending on how the application is configured by its installer. It is desirable to be able to write application code that can work efficiently in all of these cases.

To address these issues, OrbixWeb supports the collocation of client and server within the same address space. If a target object is found in an application's local address space, subsequent calls on the object will be very efficient, since direct Java method calls will be used to the IDL implementation code, and the OrbixWeb runtime classes will be bypassed.

16.7.1 Enforcing Collocation in an OrbixWeb Application

Collocation can be enforced by calling the collocated() method on the _CORBA.Orbix object as follows:

Note that the previous collocation setting is returned.

If collocation is set then OrbixWeb will never try to bind to an object outside of the caller's address space. If an object is not found in the caller's address space, _bind() will raise an INV_OBJREF exception.

Calls to collocated(true) will normally be made during the initialisation of a combined client and server. However, collocation can be unset (thereby reinstating remote binding) at any time by calling collocated(false).

16.7.2 Testing for the Presence of Enforced Collocation

A program can test whether or not collocation is currently set by making the method call:

This returns a boolean value true if collocation is set, and returns false otherwise.

16.8 Testing for Existence of Server Object

By default, _bind() raises an exception if the object on which the _bind() is attempted does not exist in the specified server. Doing so requires OrbixWeb to ping the desired object (the ping operation is defined by OrbixWeb and it has no effect on the target object). The pinging will cause the target server process to be activated if necessary, and will confirm that this server recognises the target object. Pinging can be disabled using ORB.pingDuringBind(), passing false to the parameter pingOn.

A programmer may wish to disable pinging to improve efficiency by reducing the overall number of remote invocations.

Note that if pingDuringBind(false) is called:

16.9 Client Invocations Timing Out

A client may specify a timeout within which it expects a reply from the server. This timeout can be set for all remote calls using ORB.defaultTxTimeout(), which takes the new timeout value as a parameter and returns the old timeout value (if one exists).

The value set by this method is ignored when making a connection between a client and a server. It comes into effect only when this connection has been established.

By default, no OrbixWeb operation call has a timeout.

16.10 Diagnostic Messages

The programmer may control the output of runtime diagnostic messages to the Java System.out print stream. Three levels of diagnostics are provided:

Level

Output

0

No diagnostics

1

Simple diagnostics (this is the default)

2

Full diagnostics

The level can be set by passing the appropriate level value to the method ORB.setDiagnostics().

The full diagnostic messages have the form:

[hour:minute:second.millisecond server@host event-description]

where an event is generally an operation request.



1 The CORBAservices are a set of standard services defined by The Object Management Group (OMG) to extend the core CORBA standard; they include the Naming and Event Services.



[Roadmap] [Introduction] [GS: Applications] [GS: Applets]
[IDL] [Mapping] [Programming OrbixWeb] [Publishing Objects] [Retrieving Objects] [IIOP]
[Running Clients] [Running Servers] [Exceptions] [Inheritance] [Callbacks] [Contexts]
[API Configuration] [TypeCode] [Any] [DII] [IR] [Filters] [Smart Proxies] [Loaders] [Locators]
[Index]