DX Infrastructure Manager

Expand all | Collapse all

java - probedevelopment question - "destructors"

Jump to Best Answer
  • 1.  java - probedevelopment question - "destructors"

    Posted 09-28-2015 10:27 AM

    Hi!

     

    Well, normally I am a fanatic python programmer, and well nearly naturally a lua guy, but I think it is time to gave up for waiting till a python-api exists and lua is a dying breed as far as I follow the discussions and no native support for tnt2 is implemented in lua till now *waves to Carstein Seeberg, where ever you are*.

    However, therefore I'll (have to) start with some supported language, after all that NMS/UIM years ;-), and before I start with perl, I would amputate my both thumbs, ergo java is my way (I am too lazy to use C++), but...I have some curious question.

     

    For me it is good sense that if I open some new object, I close it after dont using it anymore, learned that in my C++ classes, but doesnt found some "destructors" in the documentation. E.g. if I open a PDS for sending some stuff to from my probe to another probe or the bus, I would expect to use a "pds.close()" at the end, or at least a session.close(), something like that, is that really not implemented or am I blind?

    Does it rely on the java garbage collection to "dump unused stuff into to the  virtual rubbish bin", personally i think it is not a good style, but times might have changed and I am out of fashion ;-) and thinking too complicated.

     

    Well, propably "destructor" is not exact the right term, but didnt found a better description.

     

    Some hint or explanation would be nice, so I could sleep peacefull :-)

     

    cheers

    Matthias



  • 2.  Re: java - probedevelopment question - "destructors"
    Best Answer

    Posted 09-28-2015 04:16 PM

    I believe the only thing you need to close is the NimRequest or any other type of session.

     

    Here is a link to the SDK Javadoc that can help answer some of these questions.

    http://docs.nimsoft.com/prodhelp/en_US/Monitor/SDK/Java/index.html?help-doc.html

     

     

    Here is a link to some example code that you can use for a reference. (This is a probe built from the 2.10 framework)

    HubHealth/hub_health.java at master · BryanKMorrow/HubHealth · GitHub

     

    If you have any further questions regarding Java development please feel free to send me a message or email.

     

    Bryan



  • 3.  Re: java - probedevelopment question - "destructors"

    Posted 09-29-2015 04:17 AM

    Hi!

     

    Oh, well...

    request.close(); // close the socket

     

    found in the NimRequest-Class, hopefully it clears everythin well, in Lua there is a "pds.create()" and a "pds.delete( pdsHandle)" etc. thats why I asked, o.k. I'll rely on that close out of the NimRequest-Class, hoping not to get a Mem-Leakage over the time.

    But what I noticed, well a bit late in the description of the PDS-Class, it inherits "finalize" :-)

     

    Cheers

    Matthias



  • 4.  Re: java - probedevelopment question - "destructors"

    Posted 09-30-2015 07:08 AM

    just a follow up

    After back to the books, I realized that I am quite out of fashion, since Java uses his garbagecollector to remove unused stuff out of the memory it seems legit to do no proper (in my opinion) close or delete of Objects which are not needed.... Personally cant follow that attitude, but, well....I am out of last century ;-)