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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:28:04+00:00 2026-05-23T19:28:04+00:00

here’s my problem: I have an application that launches a simulated server locally. The

  • 0

here’s my problem: I have an application that launches a simulated server locally. The output of this operation is redirected to a log file and I want to look for a specific pattern in this log file while it’s being written.

I already implemented the tail -f simulation (I have to work on windows), but I can’t get the two threads to work fine simultaneously.

Here’s a sample (in the main) :

server.launch();
patternFinder.start();

The patternFinder extends Thread and here is what its run method looks like:

public void run() {
    while (true) {
        //tail -f implementation

        //I'll set a timeout when I can get it 
        //to work (the pattern is supposed to be found)
    }
}

If I put patternFinder.join() after the start(), the server will pause its execution and wait for the patternFinder to return (but he won’t because nothing is being written in the log). But the child thread need to block the main thread because we don’t want any instruction to be executed until the pattern is found (or the timeout limit has been reached).

Any ideas?

(ps: first post so don’t hesitate to tell me if I did something wrong or if you need any more details)

  • 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-23T19:28:05+00:00Added an answer on May 23, 2026 at 7:28 pm

    Just so this questioned doesn’t stay unanswered I found some kind of a workaround but never figured what was really the problem.

    So apparently the problem was that I was launching my server via a ProcessBuilder with a command looking like this java [arguments] [classpath] fileToLaunch. I tried a lot of things but the only one that worked was to change the command to cmd /C start java [arguments] [classpath] fileToLaunch so it starts the server in a new window and then everything worked as expected.

    If ever someone can explain that mystery to me, feel free to provide a new answer that still could be accepted.

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

Sidebar

Related Questions

Here's a coding problem for those that like this kind of thing. Let's see
Here's a problem I ran into recently. I have attributes strings of the form
Here is the issue I am having: I have a large query that needs
Here's my scenario - I have an SSIS job that depends on another prior
Here's an interesting problem. On a recently installed Server 2008 64bit I opened IE
This is beyond both making sense and my control. That being said here is
Here I had a problem that I am adding contact from the address book
Here's task: We have an sql server database. which is hosted at our server.
Here's a simple, 45 line console application that reproduces the bug on my Win
Here's a basic regex technique that I've never managed to remember. Let's say I'm

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.