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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:49:06+00:00 2026-06-13T01:49:06+00:00

I am having a file sub.srt and am reading that using multiple instances simultaneously.

  • 0

I am having a file sub.srt and am reading that using multiple instances simultaneously. It works fine. Is this possible to work same in web application with Servlets and JSP?

This is the main file

public class SingleTest 
{
public static void main(String args[]) throws Exception
{
    String s[]= new String[10];

    for(int i = 1;i<=10;i++)

        {
         SingleFileThread sft1 = new SingleFileThread(i); 
         sft1.start();
        }
}

}

This is the Thread to create multiple instances to read a single file

public class SingleFileThread extends Thread 
 {
public int t =0;
public SingleFileThread(int i)
{
    t = i;
}
  public void run()
   {
   try{
      File f = new File("E:\\Leo-Softwares\\workspace\\SingleFileThread     \\src\\test\\sub.srt");
      System.out.println("f.setReadOnly() :"+f.setReadOnly());
      FileInputStream fstream = new FileInputStream(f);
      DataInputStream in = new DataInputStream(fstream);
      BufferedReader br = new BufferedReader(new InputStreamReader(in));
      String strLine;
      while ((strLine = br.readLine()) != null)   {
          System.out.println ("Thread :"+t+"_____"+strLine);
      Thread.sleep(2000);
      }

      in.close();
        }catch (Exception e){
      System.err.println("Error: " + e.getMessage());
      }
  }
  }
  • 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-13T01:49:07+00:00Added an answer on June 13, 2026 at 1:49 am

    I didn’t get you?? Y u need to implement threads in jsp..What you exactly want to do..Because the tomcat container itself maintains the threads for your concern jsp.. What u want is may be about the session tracking i guess..Sorry but didn,t get your question properly…???

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

Sidebar

Related Questions

I have a text file having words that i need to validate. After following
I have a .txt file having some text. I want to read this file
I'm using VS2010 Ultimate. Having code: //file IntSet.h #include stdafx.h #pragma once /*Class representing
Having this text file : Breathing 1:-29.9396 9:-32.0895 13:-35.6787 2:-36.8527 17:-37.3622 8:-38.0584 14:-38.5265 18:-38.7567
Having an xml file like this: <?xml version=1.0 encoding=utf-8?> <Configuration> <Bla> BlaDiBla </Bla> </Configuration>
I am having trouble with substrings that I will implement with file i/o. I
For clarification, here's the exact question in the about_regular_expressions.rb file that I'm having trouble
I can't work out why is says that the file is open. Error is
I'm having trouble with changing the file access mode on Excel workbooks using VBA.
I am XML file, there are 10 sub-children (same hierarchy) of root, having 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.