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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:29:04+00:00 2026-06-08T16:29:04+00:00

I am trying to validate some text files. In the front end i am

  • 0

I am trying to validate some text files. In the front end i am using JTextarea, The below method is called on every time the user enter ‘Enter’ key. If the file is too big,say 5000 lines and if the user enters many times ‘Enter’ key then, i am getting unexpected results, like even if the line is valid, it shows it as invalid.

Is there any thing to do with sleep, should i have to increase the sleep time or something else has to be done? Any ideas will be helpful

private TreeSet validate(int curLine, TreeSet errorSet) {
    int increment = 0;
    int nextLine = 0;

    if (curLine == lines.length || errorSet.size() != 0) {
        return errorSet;
    } else {
        String line = lines[curLine];

        //validation starts.  After validation, line is incremented as per the requirements

         increment = 1 //As per requirement. Depends on validation results of the line



        if (increment > 0) {
            try{
                 Thread.currentThread().sleep(100);  
               }catch(Exception ex){
                 System.out.println(ex); 
               }
            nextLine = (curLine + increment);
            validate(nextLine, errorSet);
        }
    }
    return errorSet;
}  
  • 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-08T16:29:06+00:00Added an answer on June 8, 2026 at 4:29 pm

    I wouldnt look at making the sleep time any longer/shorter. Instead, I would consider doing a better time at marshalling the trigger to validate. Is there any reason to allow the input of a validation request while one is in progress? if not, i would look at blocking the call to validate while a current process is still not complete.

    If you think that multiple validations should be able to occur in tandem, I would then look to the creation of a thread pool for these actions. Testing my determine how many threads can concurrently run, and therefore determine the size of your threadpool. At this point, system memory may also play an important point, so you may want to look at those statistics while testing as well.

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

Sidebar

Related Questions

I am trying to validate email using javascript but for some reason it is
Hi I am trying to validate some user input and I'm not sure what
I am trying to validate some groups of checkboxes using Jq but I don't
I am trying to validate User Input in Windows Forms Application (using MVP design
I'm trying to validate some form data before adding it to a database however
I'm trying to validate some of the field in my form. and I want
I'm trying to validate a simple XML file against an XML schema using the
I am trying to validate an e-mail address using javascript. The problem is the
I am trying to use validatevalue:forkey: method to validate a coredata property. I have
I am using VS2005 C# and im trying to convert a pipe delimited text

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.