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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:40:33+00:00 2026-05-29T05:40:33+00:00

I created a web application that works on FLV files. This application uses a

  • 0

I created a web application that works on FLV files.

This application uses a library that I created for parsing content from flv files. This library uses FileChannel to seek a file.

I’m experiencing a strange behavior now that I seek the same flv file from different threads. Let’s say that Thread_1 and Thread_2 are both seeking movie.flv concurrently (my question comes after the example).

Thread_1

// Thread_1 moves to position 200 to read something
FileChannel chan1 = new FileInputStream("movie.flv").getFileChannel();
chan1.position(200);

Thread_2 (executing just after Thread_1)

// Thread_2 moves to position 600 to read something else
FileChannel chan2 = new FileInputStream("movie.flv").getFileChannel();
chan2.position(600);

Finally Thread_1 does:

ByteBuffer bb = ByteBuffer.allocate(40);
chan1.read(bb);

Is Thread_1 reading 40 bytes from position 200 or from position 600?
More precisely, are chan1 and chan2 independent (=can seek independently) channels or not?

From the documentation I read that the FileChannel is unique, so my bet (unfortunately) is that in the example Thread_1 is going to read from position 600 :\

In case, can you suggest a different approach for seeking a file independently from different threads?

thanks!

  • 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-29T05:40:34+00:00Added an answer on May 29, 2026 at 5:40 am

    I think you’re fine, since you’re creating a new FileInputStream on both Threads. The linked documentation states that the FileChannel returned from FileInputStream.getChannel() is unique to that file input stream.
    The documentation of FileChannel also suggests that different FileChannels generated from different sources (e.g. different FileInputStream instances) will not share state.

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

Sidebar

Related Questions

I've created a web application that uses Microsoft AzMan, and it works just fine
I've created a web part that gathers information from a Document Library. It works
I have a web application that uses a parser created with Parse::RecDescent. A parser
I created an AMP web application that was originally going to be served from
I've created a web application that I've hosted with IIS 7 on a Windows
I am working on an ASP.Net web application that must print dynamically created labels
We have created a web application, using ASP.NET, that allows users to upload documents
I've created a web.py application, and now that it is ready to be deployed,
I know that when a war file is created of my web application, i
I have created a timeclock application in C# that connects to a web service

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.