ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Delay 20 Milliseconds

Post new topic  Reply to topic
 Delay 20 Milliseconds « View previous topic :: View next topic » 
Author Message
veeru_hyd
PostPosted: Fri Oct 29, 2010 9:10 am    Post subject: Delay 20 Milliseconds Reply with quote

Novice

Joined: 28 Oct 2010
Posts: 23

Hi,

I am working on esql coding to write the code for delaying for 20milliseconds to repost the message in retry mechanism without using timer nodes.

I have written the piece of code below in esql to hold the control in a loop for 20 milli secods, but i am getting a problem. I am providing comment to the result of each statement, what i am getting. Could any one let me know, where or what is the problem?.

DECLARE startTimeStamp TIME;
DECLARE curTimeStamp TIME;
DECLARE outTime TIME;

SET startTimeStamp = CURRENT_TIME; -- Result of this statement: 10:34:22:124
SET outTime = EVAL('startTimeStamp + INTERVAL ''0.02'' SECOND');-- Result of this statement: 10:34:22:144(Incremented with 20 Milli seconds)

SET curTimeStamp = CURRENT_TIME;-- Result of this statement: 10:34:22:124(Getting the same result 'startTimeStamp')
WHILE outTime >= curTimeStamp DO
SET curTimeStamp = CURRENT_TIME;-- Result of this statement: 10:34:22:124(Getting the same result 'startTimeStamp', Its going to infinite loop. Because CURRENT_TIME is not returning the correct value from second time onwards.)
END WHILE;


Thanks,
Veera Kumar
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Oct 29, 2010 9:22 am    Post subject: Re: Delay 20 Milliseconds Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

veeru_hyd wrote:
Could any one let me know, where or what is the problem?.


The problem is you're not reading this, which clearly says:

Quote:
All calls to CURRENT_TIME within the processing of one node are guaranteed to return the same value



_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mgk
PostPosted: Fri Oct 29, 2010 9:23 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

CURRENT_TIME (and friends) always return the same value through the entire node. This is documented behaviour...
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
veeru_hyd
PostPosted: Fri Oct 29, 2010 9:36 am    Post subject: Reply with quote

Novice

Joined: 28 Oct 2010
Posts: 23

Oh!!

Thank you very much for your valuable reply.

Regards,
Veera
Back to top
View user's profile Send private message
rekarm01
PostPosted: Fri Oct 29, 2010 9:54 am    Post subject: Re: Delay 20 Milliseconds Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1415

veeru_hyd wrote:
Code:
WHILE outTime >= curTimeStamp DO
     SET curTimeStamp = CURRENT_TIME;
END WHILE;

One other point: a busy-wait loop is probably the worst way to delay processing within a thread. Other threads might want some CPU time too.

Use the Timer nodes, or perhaps write a wrapper function to call Java's Thread.sleep().
Back to top
View user's profile Send private message
zpat
PostPosted: Fri Oct 29, 2010 9:56 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

Do NOT loop like this, you will cause the CPU % to hit 100% and turn a multitasking system into a looping single tasking system.

Use a sleep function of some sort to hand control back to the OS for the necessary interval.

ESQL has a sleep function

http://www.mqseries.net/phpBB2/viewtopic.php?t=54607&sid=2910c0bf1bef82988e54ca50d9a0aa47
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Oct 29, 2010 10:46 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

zpat wrote:
Do NOT loop like this, you will cause the CPU % to hit 100% and turn a multitasking system into a looping single tasking system.




zpat wrote:
ESQL has a sleep function

http://www.mqseries.net/phpBB2/viewtopic.php?t=54607&sid=2910c0bf1bef82988e54ca50d9a0aa47


Does it have this below v7?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mgk
PostPosted: Fri Oct 29, 2010 10:48 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Quote:
Does it have this below v7?


No, SLEEP is new in 7.0.0.1
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Delay 20 Milliseconds
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.