I am new to this forum and i was just wondering if the following scenario is implementable.
Suppose a thread is reading a file and dividing it into chunks of data(lets say in the form of arraylist, where each line corresponds to a value in arraylist). Each chunk of data is associated with one thread and that thread is writing that data into a file. i want that as soon as ane line has been written,the lock should open and any thread can occupy the lock. is it possible? if yes can you provide a brief overview on how to tacle this problem.

Yes, it's possible, in fact easy, and a very common kind of thing to do. It's directly supported in the Java language.
The Oracle Java tutorials are an excellent source of info. For "a brief overview on how to tacle this problem" start reading about locks here.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.