Is there a Groovy equivalent of the Ruby Timeout module?

In Ruby I would use the Timeout module, where it executes a block and will stop executing the code if it passes the timeout.

require 'timeout'
status = Timeout::timeout(5) {
  # Something that should be interrupted if it takes too much time...

Does Groovy have something like this?


There is the TimedInterrupt annotation, but I've not tried it out yet...

Gave it a quick test, and this (poor example):

@groovy.transform.TimedInterrupt( 5L )
def loopy() {
  int i = 0
  try {
    while( true ) {
  catch( e ) {

println loopy()

Runs in the groovy console and prints out i after 5 seconds.

I get:


Need Your Help

Browser incompatible issue with scrollbar

html css html5 css3

Can anybody help me with making this link compatible. there is a small gap under the scrollbar in Chrome, and IE.

Do this using bit operators

c bit-manipulation

I want eval if a integer number between 0 and 255 is equal to 0 or equal to 224.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.