aboutsummaryrefslogtreecommitdiffstats
path: root/jdisc_core_test/test_bundles/app-a/src/main/java/com/yahoo/jdisc/bundle/ApplicationA.java
blob: b8b64264999f1e3ffc56a7ab5de27b9e84d316e8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright Vespa.ai. 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.application.Application;

import java.util.concurrent.CountDownLatch;

/**
 * @author Simon Thoresen Hult
 */
public class ApplicationA implements Application {

    private final CountDownLatch startLatch;
    private final CountDownLatch stopLatch;
    private final CountDownLatch destroyLatch;

    @Inject
    public ApplicationA(@Named("Init") CountDownLatch initLatch,
                        @Named("Start") CountDownLatch startLatch,
                        @Named("Stop") CountDownLatch stopLatch,
                        @Named("Destroy") CountDownLatch destroyLatch)
    {
        this.startLatch = startLatch;
        this.stopLatch = stopLatch;
        this.destroyLatch = destroyLatch;
        initLatch.countDown();
    }

    @Override
    public void start() {
        startLatch.countDown();
    }

    @Override
    public void stop() {
        stopLatch.countDown();
    }

    @Override
    public void destroy() {
        destroyLatch.countDown();
    }
}