else System.out.println(":j: application domain created..");
}
-
- /**
- * Destructor. Before it destroy Application Domain, destroy all registered
- * data types too.
- */
- protected void finalize()
- {
- if(!destroyAllRegTypes()) System.out.println(":j!: destroyAllRegTypes fault!");
- if(!destroy()) System.out.println(":j!: ORTEDomainADestroy fault!");
- }
-
-
/**
* Destroy the Application Domain.
*/
public boolean destroy()
{
- if (jORTEDomainAppDestroy(this.handle)) return true;
- return false;
+ if(!destroyAllRegTypes()) System.out.println(":j!: destroyAllRegTypes fault!");
+ if(!jORTEDomainAppDestroy(this.handle) || !this.props.destroy()) {
+ System.out.println(":j!: ORTEDomainADestroy fault!");
+ return false;
+ }
+ return true;
+
}
DomainEvents events,
boolean suspend)
{
+ super(); // set Default Domain Properties
+ if(props == null) {
+ this.props = DomainProp.defaultPropsCreate();
+ }
+ else {
+ this.props = props;
+ }
+ // init Domain Events
+ if(events == null) {
+ this.events.init();
+ }
+ else {
+ this.events = events;
+ }
handle = jORTEDomainMgrCreate(domain,
props.handle,
events==null ? 0 : events.getHandle(),
suspend);
}
-
- /**
- * destructor
- *
- */
- protected void finalize()
- {
- destroy();
- }
-
/*
public void create()
{}
public
boolean destroy()
{
- if(jORTEDomainMgrDestroy(this.handle)) return true;
+ if(jORTEDomainMgrDestroy(this.handle) && this.props.destroy()) return true;
System.out.println(":j!: ORTEDomainMgrDestroy() fault..");
return false;
}
private org.ocera.orte.types.MessageData msgData;
private boolean b;
+ private Domain appDomain;
/*
private int callbackEnvHandle = 0;
*/
PublProp publProp,
MessageData instance)
{
+ this.appDomain = d;
this.handle = jORTEPublicationCreate(d.handle,
publProp.getTopic(),
publProp.getTypeName(),
}
- /**
- * destructor
- *
- */
- protected void finalize()
- {
- destroy();
- }
-
-
/**
* destroy - Removes a publication.
* @return False if bad publication handle, True if succesful.
public
boolean destroy()
{
- if(jORTEPublicationDestroy(this.handle)) return true;
- System.out.println(":j!: Destroy Publication Fault!");
- return false;
+ /* TODO vyradit vypis na nasledujici radce */
+ System.out.println(":j: publication destroy called..");
+ // destroy publication
+ if(!jORTEPublicationDestroy(this.handle))
+ {
+ System.out.println(":j!: publication destroy fault!");
+ return false;
+ }
+ // destroy application domain
+ if(!appDomain.destroy())
+ {
+ System.out.println(":j!: publication destroy fault!");
+ return false;
+ }
+ System.out.println(":j: publication destroy successfull..");
+ return true;
}
subsProp.getMulticastIPAddr());
}
-
- /**
- * Destructor - destroy Subscription.
- */
- protected void finalize()
- {
- destroy();
- }
-
-
/**
* Removes a Subscription.
* @return False if bad Publication handle, True if succesful
*/
- protected
+ public
boolean destroy()
{
/* TODO vyradit vypis na nasledujici radce */
System.out.println(":j: start sending data:");
System.out.println(":j: * ********************************************* *");
- while(true)
+ for(int i = 0; i < 40; i++)
{
pub.send(hellomsg);
System.out.println("<< data to send: " + hellomsg);
JOrte.sleepMs(1000);
System.out.println(" ");
}
+ pub.destroy();
}
}
System.out.println(" ");
}
- // kill & clean subscriber - call Garbage Collector
- sub = null;
- System.out.println("Calling gc() ...");
- System.gc();
-
+ sub.destroy();
}
}
/* handler to C struct with default domain properties */
public long handle = 0;
- private String mgrs = "";
+ private String mgrs = null;
/**
* setProps - sets DomainProp
*/
public void setProps(String[] mgrs) {
+ this.mgrs = "";
for (String item : mgrs) {
this.mgrs += item + ":";
}
this.mgrs = this.mgrs.substring(0, this.mgrs.length()-1);
if(!jORTEDomainPropSet(this.handle,this.mgrs))
- System.out.println(":j: Mgrs not set !!!");
+ System.out.println(":j: DomainProp not set !!!");
}
/**
return prop;
}
- protected void finalize() {
+ public boolean destroy() {
System.out.println(":j: DomainProp destroy called..");
if(!jORTEDomainPropDestroy(this.handle,this.mgrs)) {
System.out.println(":j: DomainProp destroy fault!");
+ return false;
}
else {
System.out.println(":j: DomainProp destroy successful..");
+ return true;
}
}
break;
}
- //release fellow managers string
- (*env)->ReleaseStringUTFChars(env,mgrs,dp->mgrs);
+ if (mgrs != NULL) {
+ //release fellow managers string
+ (*env)->ReleaseStringUTFChars(env,mgrs,dp->mgrs);
+ }
//free DomainProperties memory
free(dp);