src/jdk.management.rest/share/classes/jdk/internal/management/remote/rest/RestAdapterProvider.java
author hb
Fri, 19 Jan 2018 13:46:27 +0530
branchjmx-rest-api
changeset 56026 bd531f08d7c7
permissions -rw-r--r--
1. Removed all changes to Java SE APIs 2. Changed module name to jdk.management.rest 3. Rest Adapter invoked via Module service provider 4. changed package name to jdk.internal.management.remote.rest 5. rest module and httpserver module part of platform modules

package jdk.internal.management.remote.rest;

import jdk.internal.agent.spi.AgentProvider;

import java.io.IOException;
import java.util.Properties;

public class RestAdapterProvider extends AgentProvider {

    private static final String REST_ADAPTER_NAME = "RestAdapter";

    @Override
    public synchronized void startAgent() {
        try {
            PlatformRestAdapter.init(null);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    @Override
    public synchronized void startAgent(Properties props) {
        try {
            PlatformRestAdapter.init(props);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    @Override
    public synchronized void stopAgent() {
        PlatformRestAdapter.stop();
    }

    @Override
    public String getName() {
        return REST_ADAPTER_NAME;
    }

    @Override
    public synchronized boolean isActive() {
        return PlatformRestAdapter.isStarted();
    }
}