use of com.sun.corba.ee.spi.ior.TaggedProfile in project Payara by payara.
the class POAProtocolMgr method getObjectID.
@Override
public byte[] getObjectID(org.omg.CORBA.Object obj) {
IOR ior = ((com.sun.corba.ee.spi.orb.ORB) orb).getIOR(obj, false);
java.util.Iterator iter = ior.iterator();
byte[] oid = null;
if (iter.hasNext()) {
TaggedProfile profile = (TaggedProfile) iter.next();
ObjectKey objKey = profile.getObjectKey();
oid = objKey.getId().getId();
}
return oid;
}
use of com.sun.corba.ee.spi.ior.TaggedProfile in project Payara by payara.
the class POARemoteReferenceFactory method hasSameContainerID.
@Override
public boolean hasSameContainerID(org.omg.CORBA.Object obj) throws Exception {
boolean result = false;
try {
IOR ior = (orb).getIOR(obj, false);
java.util.Iterator iter = ior.iterator();
byte[] oid = null;
if (iter.hasNext()) {
TaggedProfile profile = (TaggedProfile) iter.next();
ObjectKey objKey = profile.getObjectKey();
oid = objKey.getId().getId();
}
if ((oid != null) && (oid.length > INSTANCEKEY_OFFSET)) {
long cid = Utility.bytesToLong(oid, EJBID_OFFSET);
// To be really sure that is indeed a ref generated
// by our container we do the following checks
int keyLen = Utility.bytesToInt(oid, INSTANCEKEYLEN_OFFSET);
if (oid.length == keyLen + INSTANCEKEY_OFFSET) {
result = (cid == ejbDescriptor.getUniqueId());
}
if (logger.isLoggable(Level.FINE)) {
StringBuilder sbuf = new StringBuilder();
sbuf.append("hasSameContainerID() result: ").append(result).append("; because ==> oid.length: ").append(oid.length).append("; instance-key-length: ").append(keyLen).append("; expected oid.length: ").append(keyLen).append("+").append(INSTANCEKEY_OFFSET).append("; myContainrID: ").append(ejbDescriptor.getUniqueId()).append("; obj.containerID: ").append(cid);
logger.log(Level.FINE, sbuf.toString());
}
} else {
if (logger.isLoggable(Level.FINE)) {
if (oid == null) {
logger.log(Level.FINE, "hasSameContainerID() failed because oid=null");
} else {
logger.log(Level.FINE, "hasSameContainerID() failed because oid.length= " + "{0}; but INSTANCE_KEY_OFFSET= {1}", new Object[] { oid.length, INSTANCEKEY_OFFSET });
}
}
}
} catch (Exception ex) {
logger.log(Level.FINE, "Exception while checking for same containerID", ex);
throw ex;
}
return result;
}
Aggregations