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

  • SEARCH
  • Home
  • 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 8509693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:30:16+00:00 2026-06-11T03:30:16+00:00

I am having the code this way.. 1) Invoking the updatedb method using reflection…

  • 0

I am having the code this way..

1) Invoking the updatedb method using reflection…

for (String uniqueSym : activeSymbolsSet) {
    futureTaskUtil.submiteTask(new Helper(),
    Helper.class.getDeclaredMethod("updateDb", 
           new Class<?>[] { String.class }), new Object[] { uniqueSym }, 60);
}

– futureTaskUtil:

2) My question is this updatedb is executed as an run time task…

public Object submiteTask(final Object obj, final Method method, final Object[] params, int timeoutSeconds) throws Exception {
    if (null != obj && method != null) {
        Callable<Object> task = new Callable<Object>() {
        public Object call() {
            try {
                method.setAccessible(true);
                Object resultObj = method.invoke(obj, params);
                return resultObj;
            } catch (Exception e) {
                logger.fatal("Exception occured while invoking future task.", e);
            }
            return null;
        }
    };
    Future<Object> future = executor.submit(task);
    try {
        Object result = null;
        if (timeoutSeconds < 0) {
            result = future.get(timoutsec, TimeUnit.SECONDS);
        } else {
            result = future.get(timeoutSeconds, TimeUnit.SECONDS);
        }
        logger.info("Result of method execution is  :: " + result);
        return result;
    } catch (TimeoutException e) {
    } catch (Exception e) {
        logger.fatal("Exception occured while executing future tas : " + obj, e);
    } finally {
        future.cancel(true); // may or may not desire this
    }
}
return null;
}

can some one explain why this is executed as an seperate task and invoking the method?

  • 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-11T03:30:18+00:00Added an answer on June 11, 2026 at 3:30 am

    Future<Object> future = executor.submit(task); This is your culprit You can read about Executer Framework here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having a code this way, public int handle_refresh(Data mmsg) throws Exception {
I am having this code: <a href= onclick=return false; class=submitme>Add</a> is there any way
Having a bit of difficulty finding out the proper way to mix in code
I'm developing Scala code using Eclipse, often when I run tests I get this
I am using reflection along with linq.Dynamic, and I am having a small problem
I have this code I'm using to generate a list of records categorized into
I am having this code to check if the element has the certain class:
I'm having hard time understanding the following C# code. This code was taken from
I have this code: public static String Download(string address) { WebClient client = new
Having this code in a flex3 project worked (note the enabled property on the

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.