diff options
Diffstat (limited to 'vespajlib/src')
9 files changed, 369 insertions, 369 deletions
diff --git a/vespajlib/src/main/java/com/yahoo/concurrent/EventBarrier.java b/vespajlib/src/main/java/com/yahoo/concurrent/EventBarrier.java index 389fe8a85ea..aeab747242a 100644 --- a/vespajlib/src/main/java/com/yahoo/concurrent/EventBarrier.java +++ b/vespajlib/src/main/java/com/yahoo/concurrent/EventBarrier.java @@ -1,140 +1,140 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.concurrent;
-
-
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * Reference implementation of the 'Incremental Minimal Event Barrier'
- * algorithm. An event in this context is defined to be something that
- * happens during a time interval. An event barrier is a time interval
- * for which events may start before or end after, but not both. The
- * problem solved by the algorithm is to determine the minimal event
- * barrier starting at a given time. In other words; wait for the
- * currently active events to complete. The most natural use of this
- * algorithm would be to make a thread wait for events happening in
- * other threads to complete.
- *
- * @author <a href="mailto:havardpe@yahoo-inc.com">Haavard Pettersen</a>
- * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a>
- */
-public class EventBarrier {
-
- private final List<Entry> queue = new LinkedList<>();
- private int barrierToken = 0;
- private int eventCount = 0;
-
- /**
- * At creation there are no active events and no pending barriers.
- */
- public EventBarrier() {
- // empty
- }
-
- /**
- * Obtain the current number of active events. This method is
- * intended for testing and debugging.
- *
- * @return Number of active events.
- */
- int getNumEvents() {
- int cnt = eventCount;
- for (Entry entry : queue) {
- cnt += entry.eventCount;
- }
- return cnt;
- }
-
- /**
- * Obtain the current number of pending barriers. This method is
- * intended for testing and debugging.
- *
- * @return Number of pending barriers.
- */
- int getNumBarriers() {
- return queue.size();
- }
-
- /**
- * Signal the start of an event. The value returned from this
- * method must later be passed to the completeEvent method when
- * signaling the completion of the event.
- *
- * @return Opaque token identifying the started event.
- */
- public int startEvent() {
- ++eventCount;
- return barrierToken;
- }
-
- /**
- * Signal the completion of an event. The value passed to this
- * method must be the same as the return value previously obtained
- * from the startEvent method. This method will signal the
- * completion of all pending barriers that were completed by the
- * completion of this event.
- *
- * @param token Opaque token identifying the completed event.
- */
- public void completeEvent(int token) {
- if (token == this.barrierToken) {
- --eventCount;
- return;
- }
- --queue.get(queue.size() - (this.barrierToken - token)).eventCount;
- while (!queue.isEmpty() && queue.get(0).eventCount == 0) {
- queue.remove(0).handler.completeBarrier();
- }
- }
-
- /**
- * Initiate the detection of the minimal event barrier starting
- * now. If this method returns false it means that no events were
- * currently active and the minimal event barrier was infinitely
- * small. If this method returns false the handler will not be
- * notified of the completion of the barrier. If this method
- * returns true it means that the started barrier is pending and
- * that the handler passed to this method will be notified of its
- * completion at a later time.
- *
- * @param handler Handler notified of the completion of the barrier.
- * @return True if a barrier was started, false if no events were active.
- */
- public boolean startBarrier(BarrierWaiter handler) {
- if (eventCount == 0 && queue.isEmpty()) {
- return false;
- }
- queue.add(new Entry(eventCount, handler));
- ++barrierToken;
- eventCount = 0;
- return true;
- }
-
- /**
- * Declares the interface required to wait for the detection of a
- * minimal event barrier. An object that implements this is passed
- * to the {@link EventBarrier#startBarrier(BarrierWaiter)}.
- */
- public interface BarrierWaiter {
-
- /**
- * Callback invoked by the thread that detected the minimal
- * event barrier. Once this is called, all events taking place
- * at or before the corresponding call to {@link
- * EventBarrier#startBarrier(BarrierWaiter)} have ended.
- */
- public void completeBarrier();
- }
-
- private static class Entry {
-
- int eventCount;
- final BarrierWaiter handler;
-
- Entry(int eventCount, BarrierWaiter handler) {
- this.eventCount = eventCount;
- this.handler = handler;
- }
- }
-}
+package com.yahoo.concurrent; + + +import java.util.LinkedList; +import java.util.List; + +/** + * Reference implementation of the 'Incremental Minimal Event Barrier' + * algorithm. An event in this context is defined to be something that + * happens during a time interval. An event barrier is a time interval + * for which events may start before or end after, but not both. The + * problem solved by the algorithm is to determine the minimal event + * barrier starting at a given time. In other words; wait for the + * currently active events to complete. The most natural use of this + * algorithm would be to make a thread wait for events happening in + * other threads to complete. + * + * @author <a href="mailto:havardpe@yahoo-inc.com">Haavard Pettersen</a> + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class EventBarrier { + + private final List<Entry> queue = new LinkedList<>(); + private int barrierToken = 0; + private int eventCount = 0; + + /** + * At creation there are no active events and no pending barriers. + */ + public EventBarrier() { + // empty + } + + /** + * Obtain the current number of active events. This method is + * intended for testing and debugging. + * + * @return Number of active events. + */ + int getNumEvents() { + int cnt = eventCount; + for (Entry entry : queue) { + cnt += entry.eventCount; + } + return cnt; + } + + /** + * Obtain the current number of pending barriers. This method is + * intended for testing and debugging. + * + * @return Number of pending barriers. + */ + int getNumBarriers() { + return queue.size(); + } + + /** + * Signal the start of an event. The value returned from this + * method must later be passed to the completeEvent method when + * signaling the completion of the event. + * + * @return Opaque token identifying the started event. + */ + public int startEvent() { + ++eventCount; + return barrierToken; + } + + /** + * Signal the completion of an event. The value passed to this + * method must be the same as the return value previously obtained + * from the startEvent method. This method will signal the + * completion of all pending barriers that were completed by the + * completion of this event. + * + * @param token Opaque token identifying the completed event. + */ + public void completeEvent(int token) { + if (token == this.barrierToken) { + --eventCount; + return; + } + --queue.get(queue.size() - (this.barrierToken - token)).eventCount; + while (!queue.isEmpty() && queue.get(0).eventCount == 0) { + queue.remove(0).handler.completeBarrier(); + } + } + + /** + * Initiate the detection of the minimal event barrier starting + * now. If this method returns false it means that no events were + * currently active and the minimal event barrier was infinitely + * small. If this method returns false the handler will not be + * notified of the completion of the barrier. If this method + * returns true it means that the started barrier is pending and + * that the handler passed to this method will be notified of its + * completion at a later time. + * + * @param handler Handler notified of the completion of the barrier. + * @return True if a barrier was started, false if no events were active. + */ + public boolean startBarrier(BarrierWaiter handler) { + if (eventCount == 0 && queue.isEmpty()) { + return false; + } + queue.add(new Entry(eventCount, handler)); + ++barrierToken; + eventCount = 0; + return true; + } + + /** + * Declares the interface required to wait for the detection of a + * minimal event barrier. An object that implements this is passed + * to the {@link EventBarrier#startBarrier(BarrierWaiter)}. + */ + public interface BarrierWaiter { + + /** + * Callback invoked by the thread that detected the minimal + * event barrier. Once this is called, all events taking place + * at or before the corresponding call to {@link + * EventBarrier#startBarrier(BarrierWaiter)} have ended. + */ + public void completeBarrier(); + } + + private static class Entry { + + int eventCount; + final BarrierWaiter handler; + + Entry(int eventCount, BarrierWaiter handler) { + this.eventCount = eventCount; + this.handler = handler; + } + } +} diff --git a/vespajlib/src/main/java/com/yahoo/concurrent/SystemTimer.java b/vespajlib/src/main/java/com/yahoo/concurrent/SystemTimer.java index 5aa4990a86a..7fcb2a80265 100644 --- a/vespajlib/src/main/java/com/yahoo/concurrent/SystemTimer.java +++ b/vespajlib/src/main/java/com/yahoo/concurrent/SystemTimer.java @@ -1,41 +1,41 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.concurrent;
-
-import java.util.concurrent.TimeUnit;
-
-/**
- * This is an implementation of {@link Timer} that is backed by an actual system timer.
- *
- * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a>
- */
-public enum SystemTimer implements Timer {
-
- INSTANCE;
-
- private volatile long millis;
-
- private SystemTimer() {
- millis = TimeUnit.NANOSECONDS.toMillis(System.nanoTime());
- Thread thread = new Thread() {
-
- @Override
- public void run() {
- while (true) {
- millis = TimeUnit.NANOSECONDS.toMillis(System.nanoTime());
- try {
- Thread.sleep(1);
- } catch (InterruptedException e) {
- break;
- }
- }
- }
- };
- thread.setDaemon(true);
- thread.start();
- }
-
- @Override
- public long milliTime() {
- return millis;
- }
-}
+package com.yahoo.concurrent; + +import java.util.concurrent.TimeUnit; + +/** + * This is an implementation of {@link Timer} that is backed by an actual system timer. + * + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public enum SystemTimer implements Timer { + + INSTANCE; + + private volatile long millis; + + private SystemTimer() { + millis = TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); + Thread thread = new Thread() { + + @Override + public void run() { + while (true) { + millis = TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); + try { + Thread.sleep(1); + } catch (InterruptedException e) { + break; + } + } + } + }; + thread.setDaemon(true); + thread.start(); + } + + @Override + public long milliTime() { + return millis; + } +} diff --git a/vespajlib/src/main/java/com/yahoo/concurrent/Timer.java b/vespajlib/src/main/java/com/yahoo/concurrent/Timer.java index aefbfafb7b1..35d622613fd 100644 --- a/vespajlib/src/main/java/com/yahoo/concurrent/Timer.java +++ b/vespajlib/src/main/java/com/yahoo/concurrent/Timer.java @@ -1,19 +1,19 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.concurrent;
-
-/**
- * This interface wraps access to some timer that can be used to measure elapsed time, in milliseconds. This
- * abstraction allows for unit testing the behavior of time-based constructs.
- *
- * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a>
- */
-public interface Timer {
-
- /**
- * Returns the current value of some arbitrary timer, in milliseconds. This method can only be used to measure
- * elapsed time and is not related to any other notion of system or wall-clock time.
- *
- * @return The current value of the timer, in milliseconds.
- */
- public long milliTime();
-}
+package com.yahoo.concurrent; + +/** + * This interface wraps access to some timer that can be used to measure elapsed time, in milliseconds. This + * abstraction allows for unit testing the behavior of time-based constructs. + * + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public interface Timer { + + /** + * Returns the current value of some arbitrary timer, in milliseconds. This method can only be used to measure + * elapsed time and is not related to any other notion of system or wall-clock time. + * + * @return The current value of the timer, in milliseconds. + */ + public long milliTime(); +} diff --git a/vespajlib/src/main/java/com/yahoo/io/AbstractByteWriter.java b/vespajlib/src/main/java/com/yahoo/io/AbstractByteWriter.java index a769aa4bda4..45d58014c0e 100644 --- a/vespajlib/src/main/java/com/yahoo/io/AbstractByteWriter.java +++ b/vespajlib/src/main/java/com/yahoo/io/AbstractByteWriter.java @@ -126,4 +126,4 @@ public abstract class AbstractByteWriter extends GenericWriter implements public long appended() { return buffer.appended(); } -}
\ No newline at end of file +} diff --git a/vespajlib/src/main/java/com/yahoo/io/reader/NamedReader.java b/vespajlib/src/main/java/com/yahoo/io/reader/NamedReader.java index 7b93429acdb..c9c6c356640 100644 --- a/vespajlib/src/main/java/com/yahoo/io/reader/NamedReader.java +++ b/vespajlib/src/main/java/com/yahoo/io/reader/NamedReader.java @@ -68,4 +68,4 @@ public class NamedReader extends Reader { } } -}
\ No newline at end of file +} diff --git a/vespajlib/src/main/java/com/yahoo/protect/ClassValidator.java b/vespajlib/src/main/java/com/yahoo/protect/ClassValidator.java index 79e9d49c9f5..78c6e7d0a87 100644 --- a/vespajlib/src/main/java/com/yahoo/protect/ClassValidator.java +++ b/vespajlib/src/main/java/com/yahoo/protect/ClassValidator.java @@ -62,4 +62,4 @@ public final class ClassValidator { return unmaskedMethods(testClass, testClass.getSuperclass()); } -}
\ No newline at end of file +} diff --git a/vespajlib/src/main/java/com/yahoo/transaction/package-info.java b/vespajlib/src/main/java/com/yahoo/transaction/package-info.java index 72ac10d13d0..4e71a1130e8 100644 --- a/vespajlib/src/main/java/com/yahoo/transaction/package-info.java +++ b/vespajlib/src/main/java/com/yahoo/transaction/package-info.java @@ -2,4 +2,4 @@ @ExportPackage package com.yahoo.transaction; -import com.yahoo.osgi.annotation.ExportPackage;
\ No newline at end of file +import com.yahoo.osgi.annotation.ExportPackage; diff --git a/vespajlib/src/test/java/com/yahoo/concurrent/EventBarrierTestCase.java b/vespajlib/src/test/java/com/yahoo/concurrent/EventBarrierTestCase.java index eae792effd4..e8e27780860 100644 --- a/vespajlib/src/test/java/com/yahoo/concurrent/EventBarrierTestCase.java +++ b/vespajlib/src/test/java/com/yahoo/concurrent/EventBarrierTestCase.java @@ -1,168 +1,168 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.concurrent;
-
-import junit.framework.TestCase;
-
-/**
- * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a>
- */
-public class EventBarrierTestCase extends TestCase {
-
- public void testEmpty() {
- // waiting for an empty set of events
- Barrier b = new Barrier();
- EventBarrier eb = new EventBarrier();
-
- assertTrue(!eb.startBarrier(b));
- assertTrue(!b.done);
- assertEquals(eb.getNumEvents(), 0);
- assertEquals(eb.getNumBarriers(), 0);
-
- int token = eb.startEvent();
- eb.completeEvent(token);
-
- assertTrue(!eb.startBarrier(b));
- assertTrue(!b.done);
- assertEquals(eb.getNumEvents(), 0);
- assertEquals(eb.getNumBarriers(), 0);
- }
-
- public void testSimple() {
- // a single barrier waiting for a single event
- Barrier b = new Barrier();
- EventBarrier eb = new EventBarrier();
- assertEquals(eb.getNumEvents(), 0);
- assertEquals(eb.getNumBarriers(), 0);
-
- int token = eb.startEvent();
- assertEquals(eb.getNumEvents(), 1);
- assertEquals(eb.getNumBarriers(), 0);
-
- assertTrue(eb.startBarrier(b));
- assertTrue(!b.done);
- assertEquals(eb.getNumEvents(), 1);
- assertEquals(eb.getNumBarriers(), 1);
-
- eb.completeEvent(token);
- assertTrue(b.done);
- assertEquals(eb.getNumEvents(), 0);
- assertEquals(eb.getNumBarriers(), 0);
- }
-
- public void testBarrierChain() {
- // more than one barrier waiting for the same set of events
- Barrier b1 = new Barrier();
- Barrier b2 = new Barrier();
- Barrier b3 = new Barrier();
- EventBarrier eb = new EventBarrier();
- assertEquals(eb.getNumEvents(), 0);
- assertEquals(eb.getNumBarriers(), 0);
-
- int token = eb.startEvent();
- assertEquals(eb.getNumEvents(), 1);
- assertEquals(eb.getNumBarriers(), 0);
-
- assertTrue(eb.startBarrier(b1));
- assertTrue(eb.startBarrier(b2));
- assertTrue(eb.startBarrier(b3));
- assertTrue(!b1.done);
- assertTrue(!b2.done);
- assertTrue(!b3.done);
-
- assertEquals(eb.getNumEvents(), 1);
- assertEquals(eb.getNumBarriers(), 3);
-
- eb.completeEvent(token);
- assertTrue(b1.done);
- assertTrue(b2.done);
- assertTrue(b3.done);
- assertEquals(eb.getNumEvents(), 0);
- assertEquals(eb.getNumBarriers(), 0);
- }
-
- public void testEventAfter() {
- // new events starting after the start of a barrier
- Barrier b = new Barrier();
- EventBarrier eb = new EventBarrier();
- assertEquals(eb.getNumEvents(), 0);
- assertEquals(eb.getNumBarriers(), 0);
-
- int token = eb.startEvent();
- assertEquals(eb.getNumEvents(), 1);
- assertEquals(eb.getNumBarriers(), 0);
-
- assertTrue(eb.startBarrier(b));
- assertTrue(!b.done);
- assertEquals(eb.getNumEvents(), 1);
- assertEquals(eb.getNumBarriers(), 1);
-
- int t2 = eb.startEvent();
- assertTrue(!b.done);
- assertEquals(eb.getNumEvents(), 2);
- assertEquals(eb.getNumBarriers(), 1);
-
- eb.completeEvent(token);
- assertTrue(b.done);
- assertEquals(eb.getNumEvents(), 1);
- assertEquals(eb.getNumBarriers(), 0);
-
- eb.completeEvent(t2);
- assertEquals(eb.getNumEvents(), 0);
- assertEquals(eb.getNumBarriers(), 0);
- }
-
- public void testReorder() {
- // events completing in a different order than they started
- Barrier b1 = new Barrier();
- Barrier b2 = new Barrier();
- Barrier b3 = new Barrier();
- EventBarrier eb = new EventBarrier();
-
- int t1 = eb.startEvent();
- eb.startBarrier(b1);
- int t2 = eb.startEvent();
- eb.startBarrier(b2);
- int t3 = eb.startEvent();
- eb.startBarrier(b3);
- int t4 = eb.startEvent();
-
- assertEquals(eb.getNumEvents(), 4);
- assertEquals(eb.getNumBarriers(), 3);
-
- assertTrue(!b1.done);
- assertTrue(!b2.done);
- assertTrue(!b3.done);
-
- eb.completeEvent(t4);
- assertTrue(!b1.done);
- assertTrue(!b2.done);
- assertTrue(!b3.done);
-
- eb.completeEvent(t3);
- assertTrue(!b1.done);
- assertTrue(!b2.done);
- assertTrue(!b3.done);
-
- eb.completeEvent(t1);
- assertTrue(b1.done);
- assertTrue(!b2.done);
- assertTrue(!b3.done);
-
- eb.completeEvent(t2);
- assertTrue(b1.done);
- assertTrue(b2.done);
- assertTrue(b3.done);
-
- assertEquals(eb.getNumEvents(), 0);
- assertEquals(eb.getNumBarriers(), 0);
- }
-
- private static class Barrier implements EventBarrier.BarrierWaiter {
- boolean done = false;
-
- @Override
- public void completeBarrier() {
- done = true;
- }
- }
-}
+package com.yahoo.concurrent; + +import junit.framework.TestCase; + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class EventBarrierTestCase extends TestCase { + + public void testEmpty() { + // waiting for an empty set of events + Barrier b = new Barrier(); + EventBarrier eb = new EventBarrier(); + + assertTrue(!eb.startBarrier(b)); + assertTrue(!b.done); + assertEquals(eb.getNumEvents(), 0); + assertEquals(eb.getNumBarriers(), 0); + + int token = eb.startEvent(); + eb.completeEvent(token); + + assertTrue(!eb.startBarrier(b)); + assertTrue(!b.done); + assertEquals(eb.getNumEvents(), 0); + assertEquals(eb.getNumBarriers(), 0); + } + + public void testSimple() { + // a single barrier waiting for a single event + Barrier b = new Barrier(); + EventBarrier eb = new EventBarrier(); + assertEquals(eb.getNumEvents(), 0); + assertEquals(eb.getNumBarriers(), 0); + + int token = eb.startEvent(); + assertEquals(eb.getNumEvents(), 1); + assertEquals(eb.getNumBarriers(), 0); + + assertTrue(eb.startBarrier(b)); + assertTrue(!b.done); + assertEquals(eb.getNumEvents(), 1); + assertEquals(eb.getNumBarriers(), 1); + + eb.completeEvent(token); + assertTrue(b.done); + assertEquals(eb.getNumEvents(), 0); + assertEquals(eb.getNumBarriers(), 0); + } + + public void testBarrierChain() { + // more than one barrier waiting for the same set of events + Barrier b1 = new Barrier(); + Barrier b2 = new Barrier(); + Barrier b3 = new Barrier(); + EventBarrier eb = new EventBarrier(); + assertEquals(eb.getNumEvents(), 0); + assertEquals(eb.getNumBarriers(), 0); + + int token = eb.startEvent(); + assertEquals(eb.getNumEvents(), 1); + assertEquals(eb.getNumBarriers(), 0); + + assertTrue(eb.startBarrier(b1)); + assertTrue(eb.startBarrier(b2)); + assertTrue(eb.startBarrier(b3)); + assertTrue(!b1.done); + assertTrue(!b2.done); + assertTrue(!b3.done); + + assertEquals(eb.getNumEvents(), 1); + assertEquals(eb.getNumBarriers(), 3); + + eb.completeEvent(token); + assertTrue(b1.done); + assertTrue(b2.done); + assertTrue(b3.done); + assertEquals(eb.getNumEvents(), 0); + assertEquals(eb.getNumBarriers(), 0); + } + + public void testEventAfter() { + // new events starting after the start of a barrier + Barrier b = new Barrier(); + EventBarrier eb = new EventBarrier(); + assertEquals(eb.getNumEvents(), 0); + assertEquals(eb.getNumBarriers(), 0); + + int token = eb.startEvent(); + assertEquals(eb.getNumEvents(), 1); + assertEquals(eb.getNumBarriers(), 0); + + assertTrue(eb.startBarrier(b)); + assertTrue(!b.done); + assertEquals(eb.getNumEvents(), 1); + assertEquals(eb.getNumBarriers(), 1); + + int t2 = eb.startEvent(); + assertTrue(!b.done); + assertEquals(eb.getNumEvents(), 2); + assertEquals(eb.getNumBarriers(), 1); + + eb.completeEvent(token); + assertTrue(b.done); + assertEquals(eb.getNumEvents(), 1); + assertEquals(eb.getNumBarriers(), 0); + + eb.completeEvent(t2); + assertEquals(eb.getNumEvents(), 0); + assertEquals(eb.getNumBarriers(), 0); + } + + public void testReorder() { + // events completing in a different order than they started + Barrier b1 = new Barrier(); + Barrier b2 = new Barrier(); + Barrier b3 = new Barrier(); + EventBarrier eb = new EventBarrier(); + + int t1 = eb.startEvent(); + eb.startBarrier(b1); + int t2 = eb.startEvent(); + eb.startBarrier(b2); + int t3 = eb.startEvent(); + eb.startBarrier(b3); + int t4 = eb.startEvent(); + + assertEquals(eb.getNumEvents(), 4); + assertEquals(eb.getNumBarriers(), 3); + + assertTrue(!b1.done); + assertTrue(!b2.done); + assertTrue(!b3.done); + + eb.completeEvent(t4); + assertTrue(!b1.done); + assertTrue(!b2.done); + assertTrue(!b3.done); + + eb.completeEvent(t3); + assertTrue(!b1.done); + assertTrue(!b2.done); + assertTrue(!b3.done); + + eb.completeEvent(t1); + assertTrue(b1.done); + assertTrue(!b2.done); + assertTrue(!b3.done); + + eb.completeEvent(t2); + assertTrue(b1.done); + assertTrue(b2.done); + assertTrue(b3.done); + + assertEquals(eb.getNumEvents(), 0); + assertEquals(eb.getNumBarriers(), 0); + } + + private static class Barrier implements EventBarrier.BarrierWaiter { + boolean done = false; + + @Override + public void completeBarrier() { + done = true; + } + } +} diff --git a/vespajlib/src/test/java/com/yahoo/tensor/functions/ConcatTestCase.java b/vespajlib/src/test/java/com/yahoo/tensor/functions/ConcatTestCase.java index ace911409bc..a4077592fc7 100644 --- a/vespajlib/src/test/java/com/yahoo/tensor/functions/ConcatTestCase.java +++ b/vespajlib/src/test/java/com/yahoo/tensor/functions/ConcatTestCase.java @@ -67,4 +67,4 @@ public class ConcatTestCase { assertEquals(Tensor.from("tensor(x[2],y[4]):{{x:0,y:0}:1.0,{x:0,y:1}:3.0,{x:0,y:2}:5.0,{x:0,y:3}:6.0,{x:1,y:0}:2.0,{x:1,y:1}:4.0,{x:1,y:2}:5.0,{x:1,y:3}:6.0}"), a.concat(b, "y")); } -}
\ No newline at end of file +} |