summaryrefslogtreecommitdiffstats
path: root/jdisc_core_test/test_bundles/my-server-provider/src/main/java/com/yahoo/jdisc/bundle/MyServerProvider.java
diff options
context:
space:
mode:
Diffstat (limited to 'jdisc_core_test/test_bundles/my-server-provider/src/main/java/com/yahoo/jdisc/bundle/MyServerProvider.java')
-rw-r--r--jdisc_core_test/test_bundles/my-server-provider/src/main/java/com/yahoo/jdisc/bundle/MyServerProvider.java46
1 files changed, 46 insertions, 0 deletions
diff --git a/jdisc_core_test/test_bundles/my-server-provider/src/main/java/com/yahoo/jdisc/bundle/MyServerProvider.java b/jdisc_core_test/test_bundles/my-server-provider/src/main/java/com/yahoo/jdisc/bundle/MyServerProvider.java
new file mode 100644
index 00000000000..0e332b5d715
--- /dev/null
+++ b/jdisc_core_test/test_bundles/my-server-provider/src/main/java/com/yahoo/jdisc/bundle/MyServerProvider.java
@@ -0,0 +1,46 @@
+// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.jdisc.bundle;
+
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
+import com.yahoo.jdisc.AbstractResource;
+import com.yahoo.jdisc.service.ServerProvider;
+
+import java.util.concurrent.CountDownLatch;
+
+/**
+ * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a>
+ */
+public class MyServerProvider extends AbstractResource implements ServerProvider {
+
+ private final CountDownLatch startLatch;
+ private final CountDownLatch closeLatch;
+ private final CountDownLatch destroyLatch;
+
+ @Inject
+ public MyServerProvider(@Named("Init") CountDownLatch initLatch,
+ @Named("Start") CountDownLatch startLatch,
+ @Named("Close") CountDownLatch closeLatch,
+ @Named("Destroy") CountDownLatch destroyLatch)
+ {
+ this.startLatch = startLatch;
+ this.closeLatch = closeLatch;
+ this.destroyLatch = destroyLatch;
+ initLatch.countDown();
+ }
+
+ @Override
+ public void start() {
+ startLatch.countDown();
+ }
+
+ @Override
+ public void close() {
+ closeLatch.countDown();
+ }
+
+ @Override
+ protected void destroy() {
+ destroyLatch.countDown();
+ }
+}