|
@@ -105,7 +105,6 @@ public class TimelineClientImpl extends TimelineClient {
|
|
|
private DelegationTokenAuthenticator authenticator;
|
|
|
private DelegationTokenAuthenticatedURL.Token token;
|
|
|
private URI resURI;
|
|
|
- private boolean isEnabled;
|
|
|
|
|
|
@Private
|
|
|
@VisibleForTesting
|
|
@@ -247,55 +246,42 @@ public class TimelineClientImpl extends TimelineClient {
|
|
|
}
|
|
|
|
|
|
protected void serviceInit(Configuration conf) throws Exception {
|
|
|
- isEnabled = conf.getBoolean(
|
|
|
- YarnConfiguration.TIMELINE_SERVICE_ENABLED,
|
|
|
- YarnConfiguration.DEFAULT_TIMELINE_SERVICE_ENABLED);
|
|
|
- if (!isEnabled) {
|
|
|
- LOG.info("Timeline service is not enabled");
|
|
|
+ ClientConfig cc = new DefaultClientConfig();
|
|
|
+ cc.getClasses().add(YarnJacksonJaxbJsonProvider.class);
|
|
|
+ connConfigurator = newConnConfigurator(conf);
|
|
|
+ if (UserGroupInformation.isSecurityEnabled()) {
|
|
|
+ authenticator = new KerberosDelegationTokenAuthenticator();
|
|
|
} else {
|
|
|
- ClientConfig cc = new DefaultClientConfig();
|
|
|
- cc.getClasses().add(YarnJacksonJaxbJsonProvider.class);
|
|
|
- connConfigurator = newConnConfigurator(conf);
|
|
|
- if (UserGroupInformation.isSecurityEnabled()) {
|
|
|
- authenticator = new KerberosDelegationTokenAuthenticator();
|
|
|
- } else {
|
|
|
- authenticator = new PseudoDelegationTokenAuthenticator();
|
|
|
- }
|
|
|
- authenticator.setConnectionConfigurator(connConfigurator);
|
|
|
- token = new DelegationTokenAuthenticatedURL.Token();
|
|
|
-
|
|
|
- connectionRetry = new TimelineClientConnectionRetry(conf);
|
|
|
- client = new Client(new URLConnectionClientHandler(
|
|
|
- new TimelineURLConnectionFactory()), cc);
|
|
|
- TimelineJerseyRetryFilter retryFilter = new TimelineJerseyRetryFilter();
|
|
|
- client.addFilter(retryFilter);
|
|
|
-
|
|
|
- if (YarnConfiguration.useHttps(conf)) {
|
|
|
- resURI = URI
|
|
|
- .create(JOINER.join("https://", conf.get(
|
|
|
- YarnConfiguration.TIMELINE_SERVICE_WEBAPP_HTTPS_ADDRESS,
|
|
|
- YarnConfiguration.DEFAULT_TIMELINE_SERVICE_WEBAPP_HTTPS_ADDRESS),
|
|
|
- RESOURCE_URI_STR));
|
|
|
- } else {
|
|
|
- resURI = URI.create(JOINER.join("http://", conf.get(
|
|
|
- YarnConfiguration.TIMELINE_SERVICE_WEBAPP_ADDRESS,
|
|
|
- YarnConfiguration.DEFAULT_TIMELINE_SERVICE_WEBAPP_ADDRESS),
|
|
|
- RESOURCE_URI_STR));
|
|
|
- }
|
|
|
- LOG.info("Timeline service address: " + resURI);
|
|
|
+ authenticator = new PseudoDelegationTokenAuthenticator();
|
|
|
+ }
|
|
|
+ authenticator.setConnectionConfigurator(connConfigurator);
|
|
|
+ token = new DelegationTokenAuthenticatedURL.Token();
|
|
|
+
|
|
|
+ connectionRetry = new TimelineClientConnectionRetry(conf);
|
|
|
+ client = new Client(new URLConnectionClientHandler(
|
|
|
+ new TimelineURLConnectionFactory()), cc);
|
|
|
+ TimelineJerseyRetryFilter retryFilter = new TimelineJerseyRetryFilter();
|
|
|
+ client.addFilter(retryFilter);
|
|
|
+
|
|
|
+ if (YarnConfiguration.useHttps(conf)) {
|
|
|
+ resURI = URI
|
|
|
+ .create(JOINER.join("https://", conf.get(
|
|
|
+ YarnConfiguration.TIMELINE_SERVICE_WEBAPP_HTTPS_ADDRESS,
|
|
|
+ YarnConfiguration.DEFAULT_TIMELINE_SERVICE_WEBAPP_HTTPS_ADDRESS),
|
|
|
+ RESOURCE_URI_STR));
|
|
|
+ } else {
|
|
|
+ resURI = URI.create(JOINER.join("http://", conf.get(
|
|
|
+ YarnConfiguration.TIMELINE_SERVICE_WEBAPP_ADDRESS,
|
|
|
+ YarnConfiguration.DEFAULT_TIMELINE_SERVICE_WEBAPP_ADDRESS),
|
|
|
+ RESOURCE_URI_STR));
|
|
|
}
|
|
|
+ LOG.info("Timeline service address: " + resURI);
|
|
|
super.serviceInit(conf);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public TimelinePutResponse putEntities(
|
|
|
TimelineEntity... entities) throws IOException, YarnException {
|
|
|
- if (!isEnabled) {
|
|
|
- if (LOG.isDebugEnabled()) {
|
|
|
- LOG.debug("Nothing will be put because timeline service is not enabled");
|
|
|
- }
|
|
|
- return new TimelinePutResponse();
|
|
|
- }
|
|
|
TimelineEntities entitiesContainer = new TimelineEntities();
|
|
|
entitiesContainer.addEntities(Arrays.asList(entities));
|
|
|
ClientResponse resp = doPosting(entitiesContainer, null);
|
|
@@ -306,12 +292,6 @@ public class TimelineClientImpl extends TimelineClient {
|
|
|
@Override
|
|
|
public void putDomain(TimelineDomain domain) throws IOException,
|
|
|
YarnException {
|
|
|
- if (!isEnabled) {
|
|
|
- if (LOG.isDebugEnabled()) {
|
|
|
- LOG.debug("Nothing will be put because timeline service is not enabled");
|
|
|
- }
|
|
|
- return;
|
|
|
- }
|
|
|
doPosting(domain, "domain");
|
|
|
}
|
|
|
|