Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8558979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:56:03+00:00 2026-06-11T15:56:03+00:00

In What JVM-based scripting language support @WebService to create services at runtime? I was

  • 0

In What JVM-based scripting language support @WebService to create services at runtime? I was suggested to use Groovy to provide web services configured in a script read in at runtime.

To make this work with our existing infrastructure I need essentially to be able to add new entries to a List<Callable<String>> which I then can ask an executor to invokeAny upon.

The basic structure will be something like:

  • Groovy is embedded using GroovyScriptEngine
  • Initial list passed in from Java as “l” in the Binding passed in.
  • Groovy script defines and instantiates N objects, all implementing Callable<String> and add them to the list.
  • Back in Java the list is then further processed and then passed to the executor.

My initial feeble steps show that I will most likely need to use def c = { ... } as Callable<String> but then I get a ClassCastException. Reading up I see that it appears that this is a bit hard and involves closures.

What is the correct way to define and instantiate an object in Groovy which implements Callable<String>?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T15:56:04+00:00Added an answer on June 11, 2026 at 3:56 pm

    In Groovy 1.8 and later, groovy.lang.Closure implements Callable by default so you don’t need any “as” magic., simply:

    l << { "hello" }
    l << { "world" }
    

    For earlier versions of Groovy (1.6 and 1.7 certainly, not sure about “ancient” versions) you need to use as:

    import java.util.concurrent.Callable
    
    l << ({ "hello" } as Callable)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a JVM-based scripting language for my app and would like to see
Is JVM software based? If so in which language is JVM coded?
Both languages are JVM based with strong support for functional programming. I'm aware that
I'm somewhat newbie for WEB development based on JVM stack, but future project will
I am using a java-based tool that includes jaxws-rt-2.1.4.jar for accessing web services. I
I understand that JVM and CLR were designed as stack-based virtual machines. When JIT
What does the HotSpot JVM flag -XX:+UseCompressedOops do and when should I use it?
I currently have a JVM-based network client that does an HTTP long poll (aka
I'm curious, why did Sun decide to make the JVM stack-based and Google decide
Imagine I have a stack-based toy language that comes with the operations Push, Pop,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.