• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

TimerTask stops if a condition in its run method is fulfilled?

 
Ranch Hand
Posts: 54
Android
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've been looking at this problem for hours now and nothing seems to be clicking.

I have a local service to monitor the values retrieved using SNMP and compare them to stored values in object instance, if a value exceeds that amount defined in the instance, a telnet command is launched to that machine over the network.



In the monitor task, the run method shall run the performAction() method.



When the alerted() method is called by the alertObject, the timer seems to stop with it and shall not run again. Is the telnet command I'm launching from that instance interfering somehow?
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you saying that the method reaches line 21 (the curr.alerted() method) but does not reach line 22 (the Log statement)? If so then
1) I would check the logs to see if there is an error
2) If no error, then the curr.alerted() method must hang, blocking the Timer's thread from executing further. Figure out what makes it hang, and make it stop.

The DDMS tools which ship with the Android SDK should help you figure out the state of the timer's thread.
 
Sean Michael Hayes
Ranch Hand
Posts: 54
Android
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Steve Luke wrote:Are you saying that the method reaches line 21 (the curr.alerted() method) but does not reach line 22 (the Log statement)? If so then
1) I would check the logs to see if there is an error
2) If no error, then the curr.alerted() method must hang, blocking the Timer's thread from executing further. Figure out what makes it hang, and make it stop.

The DDMS tools which ship with the Android SDK should help you figure out the state of the timer's thread.



That was it, for the telnet, I parsed the text as it came in. I was asking it to read up to a word that actually never appears. Just telling it to disconnect when its action is sent fixed the issue.
 
Won't you please? Please won't you be my neighbor? - Fred Rogers. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic