fix(yarn-query): 修复 mapper 没有使用 spring boot 提供的 mapper
This commit is contained in:
@@ -12,6 +12,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||
import org.springframework.retry.annotation.Retryable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -29,9 +30,10 @@ public class ClusterServiceImpl implements ClusterService {
|
||||
private final ObjectMapper mapper;
|
||||
private final YarnConfiguration yarnConfiguration;
|
||||
|
||||
public ClusterServiceImpl(ObjectMapper mapper, YarnConfiguration yarnConfiguration) {
|
||||
this.mapper = mapper;
|
||||
public ClusterServiceImpl(YarnConfiguration yarnConfiguration, Jackson2ObjectMapperBuilder builder) {
|
||||
this.yarnConfiguration = yarnConfiguration;
|
||||
|
||||
this.mapper = builder.build();
|
||||
}
|
||||
|
||||
@Cacheable(value = "cluster-info", sync = true)
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.eclipse.collections.api.factory.Lists;
|
||||
import org.eclipse.collections.api.list.ImmutableList;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -30,9 +31,10 @@ public class JobAutoRefreshServiceImpl implements JobService {
|
||||
private final ObjectMapper mapper;
|
||||
private final YarnConfiguration yarnConfiguration;
|
||||
|
||||
public JobAutoRefreshServiceImpl(ObjectMapper mapper, YarnConfiguration yarnConfiguration) {
|
||||
this.mapper = mapper;
|
||||
public JobAutoRefreshServiceImpl( YarnConfiguration yarnConfiguration, Jackson2ObjectMapperBuilder builder) {
|
||||
this.yarnConfiguration = yarnConfiguration;
|
||||
|
||||
this.mapper = builder.build();
|
||||
}
|
||||
|
||||
private static final AtomicReference<ImmutableList<YarnApplication>> CACHE = new AtomicReference<>(Lists.immutable.empty());
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||
import org.springframework.retry.annotation.Retryable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -33,9 +34,10 @@ public class JobServiceImpl implements JobService {
|
||||
private final ObjectMapper mapper;
|
||||
private final YarnConfiguration yarnConfiguration;
|
||||
|
||||
public JobServiceImpl(ObjectMapper mapper, YarnConfiguration yarnConfiguration) {
|
||||
this.mapper = mapper;
|
||||
public JobServiceImpl(YarnConfiguration yarnConfiguration, Jackson2ObjectMapperBuilder builder) {
|
||||
this.yarnConfiguration = yarnConfiguration;
|
||||
|
||||
this.mapper = builder.build();
|
||||
}
|
||||
|
||||
@Cacheable(value = "job-list", sync = true)
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.eclipse.collections.api.list.ImmutableList;
|
||||
import org.eclipse.collections.api.list.MutableList;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -32,9 +33,10 @@ public class QueueAutoRefreshServiceImpl implements QueueService {
|
||||
private final ObjectMapper mapper;
|
||||
private final YarnConfiguration yarnConfiguration;
|
||||
|
||||
public QueueAutoRefreshServiceImpl(ObjectMapper mapper, YarnConfiguration yarnConfiguration) {
|
||||
this.mapper = mapper;
|
||||
public QueueAutoRefreshServiceImpl(YarnConfiguration yarnConfiguration, Jackson2ObjectMapperBuilder builder) {
|
||||
this.yarnConfiguration = yarnConfiguration;
|
||||
|
||||
this.mapper = builder.build();
|
||||
}
|
||||
|
||||
private static final AtomicReference<ImmutableList<YarnQueue>> CACHE = new AtomicReference<>(Lists.immutable.empty());
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||
import org.springframework.retry.annotation.Retryable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -31,9 +32,10 @@ public class QueueServiceImpl implements QueueService {
|
||||
private final ObjectMapper mapper;
|
||||
private final YarnConfiguration yarnConfiguration;
|
||||
|
||||
public QueueServiceImpl(ObjectMapper mapper, YarnConfiguration yarnConfiguration) {
|
||||
this.mapper = mapper;
|
||||
public QueueServiceImpl(YarnConfiguration yarnConfiguration, Jackson2ObjectMapperBuilder builder) {
|
||||
this.yarnConfiguration = yarnConfiguration;
|
||||
|
||||
this.mapper = builder.build();
|
||||
}
|
||||
|
||||
@Cacheable(value = "queue-list", sync = true)
|
||||
|
||||
@@ -32,12 +32,12 @@ public class QueueResponseParseTest {
|
||||
}
|
||||
});*/
|
||||
|
||||
YarnConfiguration configuration = new YarnConfiguration();
|
||||
/*YarnConfiguration configuration = new YarnConfiguration();
|
||||
configuration.setCluster("b5");
|
||||
configuration.setWebUrl("http://b5m2.hdp.dc:8088");
|
||||
QueueServiceImpl service = new QueueServiceImpl(mapper, configuration);
|
||||
for (YarnQueue yarnQueue : service.list()) {
|
||||
System.out.println(yarnQueue.getQueueName());
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user