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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:09:47+00:00 2026-05-25T19:09:47+00:00

I have a little task for my interview (sic!). I need to create java

  • 0

I have a little task for my interview (sic!).
I need to create java CLI programm that searchs for specific files matched some pattern. They said I need to use multi-threading approach without using util.concurrent package and to provide good performance on parallel controllers.

From my point of view it’s pretty simple – I can create specific thread for each subfolder and run over it’s contents, and for each subfolder run another Thread…
But it can’t be so much easy 🙂 Maybe someone can suggest me typical pitfalls that I shoud be avare of. Or any advice of correct way to implement this in Java will be highly appreciated.

Thanks!

UPD1
File name should match pattern.

  • 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-25T19:09:48+00:00Added an answer on May 25, 2026 at 7:09 pm

    The problem would be to find a good number of threads and distributing works as equally as possbible.

    Assuming you don’t know the number of files and subdirectories in each folder, that could become quite tricky.

    Here’s an idea for a start:

    What you might do is create a number of threads that operate on a central folder list and spawn a thread per folder you encounter up to a certain maximum. Each thread could then put the subfolders of the directory it works on to the central list and when it is done it might pick the next from that list.

    If a folder is put on the list and the maximum number of threads is not reached, a new thread is spawned immediately.

    If the thread has run out of work and the folder list is empty, it could either stop (requiring you to spawn a new one if needed) or wait until either there’s a folder on the list or the application signals that all folders are processed.

    Finally, don’t forget to synchronize on the folder list.

    Hope that helps you to get started.

    Edit: (don’t take the following too seriously 🙂 )

    You could also use another thread pool implementation that doesn’t use the java.util.concurrent package 🙂

    Edit 2: Basically what I described above is a simple and task specific thread pool implementation. You might try and look for more information on building a thread pool yourself (in the context of your assignment a thread pool task would be scanning one folder).

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

Sidebar

Related Questions

I have a small task in Flash, that I'm having a little trouble with.
I have a task that I need to perform for a friend as a
I have a specific task and after doing some research, I feel a little
I have been recently assigned a task in which I need to create a
I have this little rake task: namespace :db do namespace :test do task :reset
I need MatLab for 2D and 3D modeling. I have little experience in MatLab.
I have a little dilemma that maybe you can help me sort out. I've
Now I'm solving web server performance testing task and a have a little problem.
I have two classes, Task and Subtask. Subtask varies very little from Task except
I have an EditTask View for editing the following properties for a Task that

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.