- Timestamp:
- 09/27/13 17:50:41 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/supervisor/src/main/java/omq/server/RemoteWrapper.java
r83 r91 24 24 private RemoteObject obj; 25 25 private int numThreads; 26 // private AtomicInteger busy; 27 private Object waitLock; 26 28 private ArrayList<InvocationThread> invocationList; 27 29 private BlockingQueue<Delivery> deliveryQueue; … … 30 32 this.obj = obj; 31 33 this.numThreads = numThreads; 34 // this.busy = new AtomicInteger(0); 35 this.waitLock = new Object(); 32 36 invocationList = new ArrayList<InvocationThread>(); 33 37 deliveryQueue = new LinkedBlockingDeque<QueueingConsumer.Delivery>(); … … 36 40 37 41 for (int i = 0; i < numThreads; i++) { 38 InvocationThread thread = new InvocationThread(obj, deliveryQueue, serializer);42 InvocationThread thread = new InvocationThread(obj, this, serializer); 39 43 invocationList.add(thread); 40 44 thread.start(); … … 51 55 */ 52 56 public void notifyDelivery(Delivery delivery) throws Exception { 57 58 // // Ensure there is at least one thread available 59 // while (this.busy.get() == this.numThreads) { 60 // System.out.println("Waiting for a thread available"); 61 // logger.debug("Object reference: " + obj.getRef() + " is busy"); 62 // 63 // synchronized (waitLock) { 64 // waitLock.wait(); 65 // } 66 // } 67 // Notify an available thread 53 68 this.deliveryQueue.put(delivery); 69 54 70 } 55 71 … … 63 79 } 64 80 } 81 82 // public int increaseBusy() { 83 // return this.busy.incrementAndGet(); 84 // } 85 // 86 // public int decreaseBusy() { 87 // int value = this.busy.decrementAndGet(); 88 // synchronized (waitLock) { 89 // waitLock.notifyAll(); 90 // } 91 // return value; 92 // } 65 93 66 94 public RemoteObject getObj() { … … 95 123 this.deliveryQueue = deliveryQueue; 96 124 } 125 126 public Object getLock() { 127 return waitLock; 128 } 129 130 public void setLock(Object lock) { 131 this.waitLock = lock; 132 } 97 133 }
Note: See TracChangeset
for help on using the changeset viewer.