Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.List;
- import java.util.*;
- import java.net.*;
- import java.io.*;
- class FileService extends Thread
- {
- public LinkedList<String> list1 = new LinkedList<String>();
- public List list;
- public String[] listOfNames = new String[10];
- public FileService(List list)
- {
- this.list = list;
- }
- public void run()
- {
- try
- {
- while (true)
- {
- synchronized (list1)
- {
- if (!list1.isEmpty())
- {
- String s = list1.remove(0);
- System.out.println(this + " was empty so we removed it " + s);
- }
- else
- {
- list1.wait(1000);
- }
- }
- }
- }
- catch (InterruptedException e) {
- }
- }
- }
- class Main
- {
- public static void main(String[] args)
- {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment