need timerStartDate of timer and timerconfig ejb3.0 - timer

I have a TimerConfig and a Timer Object and use EJB 3.0. All works well, but "onTimeout" I want to get the information, when the timer was initialized. I cannot find a method such as timerStartDate.
Should I use timerConfig.setInfo and put the date when timer is initialized? Is this the only way?

Yes, if you want to know when createTimer was called, then you'll have to store it in setInfo. There is no builtin mechanism.

Related

What is a Timer ID?

I feel like this is a dumb question. But I've been struggling to understand some concepts and examples because they implement a timer ID in them and I don't really get what it is. Is it just a variable you assign a timer to?
Assuming JavaScript because of the "settimeout" tag you added, setTimeout and setInterval return an ID if they succeeded in being setup. This ID can be used to refer to that timeout or interval. Generally, this is used to cancel a timeout before it finishes, or stop an interval from running again. You can do this with the clearTimeout and clearInterval functions.
More information: https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout
In the future, you can find information like this very easily with a search engine.

FreeRTOS how to change the callback function of a software timer

I'm using the software timer API from FreeRTOS to create a timer
xTimer = xTimerCreate("Timer", 100, 0, (void *) 0, vTimerCallback0);
Is there a way to change to callback of the timer to another function?
Another way to do it could be that the callback that you register when the timer gets created (vTimerCallback0) calls one from a set of other functions after some decision making in your code. It depends on what exactly you are trying to do.
I don't think there is one - the software timer API is here - https://www.freertos.org/FreeRTOS-Software-Timer-API-Functions.html . Curiously nobody has ever requested that before but I can add a function to do it easily enough - if you subscribe to check-in notifications you will see when it gets added.

How can I use a single-shot timer to implement an repeating timer?

In some easy system, it only offer the single-shot timer APIs. But I want an repeating timer. How can I achieve it? Please give an example, thank you so much.
Especially,the callback function of single-shot timer is defined like
void OnTimer(void);
When I want to use a lot timer and try to manage them, I find this problem.

Ratchet WampServerInterface and timer

I was wondering if there was a way too start a timer from an WampServerInterface instance?
I saw that you can set it on the server object. But I need to create it from my WanpServerInterface object if somebody subscribe to a certain event.
Any toughts?
Regards,
Timer is a function on the loop object so it can be called by getting the loop object. But as the documentation is really minimalistic, it took me sometime to find the answer (couple of hours and more)and get back here.
class MyObject implements WampServerInterface
{
...
$this->loop->addPeriodicTimer(2, function($timer) { call_user_func(array($this, 'startCountdown'), $timer); }) ;
...
}
You can inject the EventLoop that's passed/created in IoServer into your WAMP application and create timers with it once users subscribe to your desired Topic.

which is the best method to poll for a variable [C/Linux]

I have to check if a variable is changed from a database(custom) every second using C/Linux. I would like to know the methods available for polling a variable in C/Linux. Thanks

Resources