Advertisement
iPeer

Untitled

Sep 23rd, 2011
1,269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.66 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. public class bn
  4.     implements Runnable
  5. {
  6.  
  7.     private bn()
  8.     {
  9.         b = new Object();
  10.         c = Collections.synchronizedSet(new HashSet());
  11.         d = Collections.synchronizedList(new ArrayList());
  12.         e = true;
  13.         Thread thread = new Thread(this, "File IO Thread");
  14.         thread.setPriority(5);
  15.         thread.start();
  16.     }
  17.  
  18.     public void run()
  19.     {
  20.         do
  21.             b();
  22.         while(true);
  23.     }
  24.  
  25.     private void b()
  26.     {
  27.         for(int i = 0; i < d.size(); i++)
  28.         {
  29.             dv dv1 = (dv)d.get(i);
  30.             if(!dv1.v_())
  31.                 synchronized(b)
  32.                 {
  33.                     d.remove(dv1);
  34.                     c.remove(dv1);
  35.                     if(c.isEmpty())
  36.                         e = true;
  37.                 }
  38.             try
  39.             {
  40.                 Thread.sleep(5L);
  41.             }
  42.             catch(InterruptedException interruptedexception)
  43.             {
  44.                 interruptedexception.printStackTrace();
  45.             }
  46.         }
  47.  
  48.     }
  49.  
  50.     public void a(dv dv1)
  51.     {
  52. label0:
  53.         {
  54.             synchronized(b)
  55.             {
  56.                 e = false;
  57.                 if(!c.contains(dv1))
  58.                     break label0;
  59.             }
  60.             return;
  61.         }
  62.         c.add(dv1);
  63.         d.add(dv1);
  64.         obj;
  65.         JVM INSTR monitorexit ;
  66.     }
  67.  
  68.     public void a()
  69.         throws InterruptedException
  70.     {
  71.         while(!e)
  72.             Thread.sleep(10L);
  73.     }
  74.  
  75.     public static final bn a = new bn();
  76.     private Object b;
  77.     private Set c;
  78.     private List d;
  79.     private volatile boolean e;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement