PxPlus User Forum

Twitter Twitter Twitter

Author Topic: Putting time out on an object  (Read 797 times)

Peter.Higgins

  • Diamond Member
  • *****
  • Posts: 124
    • View Profile
Putting time out on an object
« on: August 18, 2020, 05:26:41 PM »
Wondering if anyone has attempted a time out on an object.  Contemplating an extract on a file record using an object file to be cleared by the object shutting down if not shutdown during normal processing.  Any ideas??

Devon Austen

  • Administrator
  • Diamond Member
  • *****
  • Posts: 382
  • Don’t Panic
    • View Profile
    • PVX Plus Technologies
Re: Putting time out on an object
« Reply #1 on: August 19, 2020, 08:15:27 AM »
I have not done this myself but here is how I would attempt it.

Add a local property to your object and call it something like lastUsedTime$ and add a method to the object called something like isTimedOut(). The method would compare the current time to the lastUsedTime and if the difference exceeds a certain amount return 1 else return 0. Then in the other methods you can set lastUsedTime to the current time. This was a program can simply call isTimedOut() and no if it has been too long since it was last used they can drop the object. This program can simply just check periodically if the object is timed out.
Principal Software Engineer for PVX Plus Technologies LTD.