Skip to main content

Summary This article clarifies how to programmatically test whether two object references are identical.
Environment

Orbix 6.3.* Java

All Supported Operating Systems

Question/Problem Description How to programmatically test whether two object references are identical?
Clarifying Information
Error Message
Defect/Enhancement Number
Cause
Resolution

The _is_equivalent() method can be used to test whether two references are identical.

If _is_equivalent() returns true, you can be sure that both references point to the same object.

A false return does not necessarily indicate that the references denote different objects, only that the internals of the two references differ in some way. The information in references can vary among different ORB implementations. For example, one vendor might enhance performance by adding cached information to references, to speed up connection establishment. Because _is_equivalent() tests for absolute identity, it cannot distinguish between vendor-specific and generic information.

Below Java code snippet shows the _is_equivalent() usage:

org.omg.CORBA.Object obj1, obj2 = null;

obj1 = orb.string_to_object("IOR:...");
obj2 = orb.string_to_object("IOR:...");

if (obj1._is_equivalent(obj2))
    System.out.println("Same object");
else
    System.out.println("Different objects");

Workaround
Notes
Attachment

#Orbix
#KnowledgeDocs