1 4 package com.tc.objectserver.api; 5 6 import com.tc.async.api.AddPredicate; 7 import com.tc.async.api.EventContext; 8 import com.tc.async.api.Sink; 9 import com.tc.exception.ImplementMe; 10 import com.tc.stats.Stats; 11 12 import java.util.Collection ; 13 import java.util.LinkedList ; 14 import java.util.List ; 15 16 19 public class TestSink implements Sink { 20 private final List queue = new LinkedList (); 21 22 public boolean addLossy(EventContext context) { 23 return false; 24 } 25 26 public void addMany(Collection contexts) { 27 } 29 30 public void add(EventContext context) { 31 synchronized (queue) { 32 queue.add(context); 33 queue.notifyAll(); 34 } 35 } 36 37 public EventContext waitForAdd(long millis) throws InterruptedException { 38 synchronized (queue) { 39 if (queue.size() < 1) { 40 queue.wait(millis); 41 } 42 return queue.size() < 1 ? null : (EventContext) queue.get(0); 43 } 44 } 45 46 public EventContext take() throws InterruptedException { 47 synchronized (queue) { 48 while (queue.size() < 1) { 49 queue.wait(); 50 } 51 return (EventContext) queue.remove(0); 52 } 53 } 54 55 public void setAddPredicate(AddPredicate predicate) { 56 } 58 59 public AddPredicate getPredicate() { 60 return null; 61 } 62 63 public int size() { 64 return queue.size(); 65 } 66 67 public List getInternalQueue() { 68 return queue; 69 } 70 71 public void clear() { 72 throw new ImplementMe(); 73 } 74 75 public void unpause() { 76 throw new ImplementMe(); 77 } 78 79 public void pause(List pauseEvents) { 80 throw new ImplementMe(); 81 } 82 83 public void enableStatsCollection(boolean enable) { 84 throw new ImplementMe(); 85 } 86 87 public Stats getStats(long frequency) { 88 throw new ImplementMe(); 89 } 90 91 public Stats getStatsAndReset(long frequency) { 92 throw new ImplementMe(); 93 } 94 95 public boolean isStatsCollectionEnabled() { 96 throw new ImplementMe(); 97 } 98 99 public void resetStats() { 100 throw new ImplementMe(); 101 } 102 103 } | Popular Tags |