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 7592691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:58:26+00:00 2026-05-30T20:58:26+00:00

I’ve recently worked on refactoring a system that processes bundles of client data. The

  • 0

I’ve recently worked on refactoring a system that processes bundles of client data. The system executes a series of steps, each of which consumes files from previous steps (and sometime in-memory data), and produces its own output, in the form of files or data. Sometimes the output data for a particular step is already available. I have to be careful to make sure that, when one step fails, we continue to run all possible steps (ones that don’t depend on the failed step), so that the final output is as complete as possible. Furthermore, not all steps have to be run in all situations.

Previously, the relationships were all implicit in the structure of the code. For instance:

void processClientData() {
    try {
        processA();
    } catch(Exception e) {
        log.log(Level.SEVERE, "exception occured in step A", e);
        processC(); // C doesn't depend on A, so we can still run it.
        throw e;
    }

    processB();
    processC();
    //etc... for ~20 steps
}

I changed this to make the dependencies explicit, the error handling uniform, etc, by introducing Tasks:

public interface Task {
    List<Task> getDependencies();
    void execute(); //only called after all dependencies have been executed
}

public class TaskRunner {
    public void run(Set<Task> targets) {
        // run the dependencies and targets ala ANT
        // make sure to run all possible tasks on the "road" to targets
        // ...
    }
}

This starts to feel a lot like a very watered-down version of a build system with dependency management (ANT, being most familiar to me). I don’t want to pull in ANT for this kind of thing, and I certainly don’t want to write out the XML.

I have my system up and running (mostly), but it still feels a bit hacked together, and I have since reflected on how much I hate to be reinventing the wheel. I would expect that this is a fairly common problem – one that has been solved many times over by people smarter than me. Alas, a few hours of googling turned up nothing

Is there a library that implements this sort of thing, without being a really heavy-weight build system? I’d also appreciate any pointers, including libraries in other languages (or even novel systems) that I should take inspiration from.

EDIT: I appreciate the suggestions (and I will give them due consideration), but I’m really NOT looking for a “build system” per se. What I am looking for is something more like the kernel of a build system, that I could just call directly from Java and use as a small, low-overhead library for doing said dependency analysis, task execution, and resulting resource management. Like I said, I have existing (working) code in pure Java, and I don’t want to bring in XML and all of the baggage that comes with it, without a very compelling reason.

  • 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-05-30T20:58:27+00:00Added an answer on May 30, 2026 at 8:58 pm

    Take a look at jsr166 fork/join framework. It seems to me this is exactly what you’re trying to accomplish.

    http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ForkJoinTask.html

    This is included in JDK7 but is available as a separate jar for 5 and 6. If I wasn’t on my tablet I’d write a more comprehensive example. Maybe someone else can expand in the meantime.

    public class DependencyTreeTask extends RecursiveAction {
    
      private final List<DependencyTreeTask> dependencies = new ArrayList<Task>();
    
      public void addDependency(DependencyTreeTask t) { dependencies.add(t) }
    
      public void compute() {
        invokeAll(dependencies);
      }
    
    }
    
    ...
    // build tree...
    DependencyTreeTask root = ...
    ForkJoinPool pool = new ForkJoinPool();
    pool.invoke(root);
    

    You also have to take care if your graph is unconnected, but there are a well known set of algorithms for determining this.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into

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.