Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 31 package org.objectweb.proactive.core.util; 32 33 42 public class ThreadStoreImpl implements ThreadStore, java.io.Serializable { 43 44 private int counter; 45 private boolean defaultOpenState; 46 private transient boolean open; 47 48 51 public ThreadStoreImpl() { 52 this(true); 53 } 54 55 56 60 public ThreadStoreImpl(boolean isOpened) { 61 defaultOpenState = isOpened; 62 open = defaultOpenState; 63 } 64 65 66 69 public int threadCount() { 70 return counter; 71 } 72 73 74 77 public synchronized void enter() { 78 while (!open) { 79 try { 80 wait(); 81 } catch (InterruptedException e) {} 82 } 83 counter++; 84 } 85 86 87 90 public synchronized void exit() { 91 counter--; 92 notifyAll(); 93 } 94 95 96 99 public synchronized void close() { 100 open = false; 101 while (counter != 0 && !open) { 102 try { 103 wait(); 104 } catch (InterruptedException e) {} 105 } 106 } 107 108 109 112 public synchronized void open() { 113 open = true; 114 notifyAll(); 115 } 116 117 118 122 private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { 123 out.defaultWriteObject(); 124 } 125 126 private void readObject(java.io.ObjectInputStream in) throws java.io.IOException , ClassNotFoundException { 127 in.defaultReadObject(); 128 open = defaultOpenState; 130 } 131 } 132
| Popular Tags
|