IDL Datatypes – Part 2
The Interface Type
- The Interface describes the services provided by a CORBA object.
- These services appear in the form of operations (or methods), resembling methods in Object Oriented Languages.
- The difference is that IDL is used only to specify the interfaces of these methods, whereas the language like Java and C++ are used to specify interfaces and (usually) provide implementations for those interfaces methods.
- The IDL interface type is very much like the Java interface type because neither provides an implementation for the methods defined.
- However, the major difference is that IDL interfaces can contain attributes, whereas Java interfaces don’t.
- An IDL interface definition can thus be compared to a C++ header file containing a class definition. Also a C++ class whose methods are all pure virtual can be considered analogous to the IDL interface.
- All methods defined within an IDL interface are public they can be called by any other object having a reference to the interface’s implementation object.
- IDL interfaces usually describe remote objects. So it provides some additional modifiers to further describe the interface and its members.
Methods and Parameters
- Methods defines the functionality of the objects.
- Although the object’s implementation determines how the object behaves, the interface’s method definitions determine what behavior the object implementing that interface provides
- These method definitions are often called method signatures or just signatures.
- IDL methods can use any IDL data types as input and output parameters – primitive types, structs, sequences and even interfaces.
- The general syntax,
[oneway] return_type methodName(param1_dir param1_type param1_name, param2_dir param2_type param2_name, …);
- The param dir modifier specifies the direction of each parameter (in, out, inout)
- A method signature, often simple called a signature, describes what a method does, what parameters (and their types) the method takes as input, and what parameters it returns as O/P.
in, out and inout parameters
- in parameter servers as input to the method
- out parameter is an output from the method
- inout parameter serves as an input to and an output from the method.
- In remote method terms, any in and inout parameters are marshaled across the network to the remote object.
- After the method executes, any out and inout parameters along with the method’s return value are marshaled back to the calling object.
oneway methods
- When an object calls a method on a remote object, that calling object waits (this is called blocking) for the method to execute and return.
- When the remote object finishes processing the method invocation, (called a request) it returns to the calling object then continue its processing.
- In general blocking refers to any point at which a process or thread is waiting for a particular resource or another process/thread.
- Within the context of CORBA, if a client invokes a remote method and must wait for the result to be returned, the client is said to ‘block’.
- A request is simply another name for a RMI. This term is commonly used when referring to the operation of a distributed system.
- In the CORBA’s Dynamic Invocation Interface (DII), the remote method can be invoked through a request object.
- When a method is declared oneway, it means that the object calling that method will not block. Rather, the object will call the remote method and then immediately continue processing, while the remote object executes the remote method.
- The advantage of this approach is that the calling object can continue working rather than wait for the remote object to complete the request.
- The disadvantage is that the method invocation returns before the method execution is completed, so the method cannot return a value.
- Therefore, for an oneway method, the return value must be declared as void, and all parameters must be declared as in.
- Another disadvantage is, a oneway method cannot raise any exception. Also, the calling object has no way of knowing whether the method executed successfully; the CORBA infrastructure makes a best-effort attempt to execute the method, but success is not guaranteed.
- Therefore, the oneway methods are most useful for situations in which one object wants to inform another object of a particular status but
- Does not consider the message to be essential
- Does not expect a response
- Multithreading can be used to overcome this blocking problem by creating a separate thread to invoke the remote method.
- While that thread is blocked, waiting for the result to be returned, other threads can continue working.

