문제

The following sequence gives me an IOR and keeps the MyObj instance somewhere inside CORBA (JacORB) so that the IOR can be used at a later stage:

MyObj myObj = new MyObj(); 
org.omg.CORBA.Object ref = poa.servant_to_reference(myObj); 
org.omg.CORBA.Object href = MyObjHelper.narrow(ref); 
String ior = orb.object_to_string(href); 

Can I somehow tell JacORB to discard "myObj" (at a later stage, of course)? References are kept forever in some Hastable (inside JacORB), and when creating a lot of entries, a wild OutOfMemory appears at some point. I want JacORB to forget about my object when I tell it to.

도움이 되었습니까?

해결책

The first thing that you can do is deactivate unused servants, *poa.deactivate_object()*. The problem is know when the servant can be deactivated.

The best ideia is implement ServantManager with some timeout policy.

Don't forget about POA policies.

다른 팁

Whenever you reference Corba object, it's internal reference count increases by one. This is similar to Java garbage collector mechanism.

That means that myObj will be garbage collected only when ior, href and ref are garbage collected.

There's also an option to manually decrease Corba reference count of myObj but this is not recommended because then you will defeat Corba's reference count mechanism and cause unpredictable behavior.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top