Skip to content

Commit

Permalink
code cleaned
Browse files Browse the repository at this point in the history
  • Loading branch information
interair committed Feb 19, 2017
1 parent 59fc2c6 commit ab76f83
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ class StopThenStartEachStrategy {
private ContainerConfigTasklet containerConfig;

/**
*
* @param predicate filter containers
* @param processor change containers
*/
Expand All @@ -66,19 +65,20 @@ public void run(ContainerPredicate predicate, ContainerProcessor processor) {
}

protected void updateContainer(List<ProcessedContainer> containers, ContainerProcessor processor) {
ProcessedContainer curr = null;
try {
for(ProcessedContainer container: containers) {

for (ProcessedContainer container : containers) {
try {
ProcessedContainer withConfig = containerConfig.process(container);
containerStopper.execute(withConfig);
containerRemover.execute(withConfig);
ProcessedContainer newVersion = processor.apply(withConfig);
ProcessedContainer newContainer = containerCreator.execute(newVersion);
healthchecker.execute(newContainer);
} catch (Exception e) {
jobContext.fire("Error on container {0}", container);
throw e;
}
} catch (Exception e) {
jobContext.fire("Error on container {0}", curr);
throw e;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ private void checkOffline(Throwable th) {
}
updated = offlineRef.compareAndSet(old, new OfflineCause(timeout, th));
}
if(updated && old == null) {
if(old == null) {
fireEvent(new DockerServiceEvent(this, StandardActions.OFFLINE));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import lombok.Data;

/**
* Argument for {@link DockerService#killContainer(String)}
* Argument for {@link DockerService#killContainer(KillContainerArg)}
*/
@Builder
@Data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static class UpdateStatus {
public enum UpdateState {
UPDATING,
PAUSED,
COMPLETED;
COMPLETED
}

@Data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public enum NodeState {
UNKNOWN,
DOWN,
READY,
DISCONNECTED;
DISCONNECTED
}

/**
Expand All @@ -192,7 +192,7 @@ public enum NodeState {
public enum Reachability {
UNKNOWN,
UNREACHABLE,
REACHABLE;
REACHABLE
}

/**
Expand All @@ -202,7 +202,7 @@ public enum Reachability {
public enum NodeAvailability {
ACTIVE,
PAUSE,
DRAIN;
DRAIN
}

/**
Expand All @@ -211,6 +211,6 @@ public enum NodeAvailability {
@JtEnumLower
public enum NodeRole {
WORKER,
MANAGER;
MANAGER
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ public class DiscoveryStorageImpl implements DiscoveryStorage {
private final DockerServices services;
private final NodeStorage nodeStorage;
private final KvMap<NodesGroup> clusters;
private final String prefix;
private final AccessContextFactory aclContextFactory;
private final MessageBus<NodesGroupEvent> messageBus;
private final AutowireCapableBeanFactory beanFactory;
Expand All @@ -91,7 +90,7 @@ public DiscoveryStorageImpl(KvMapperFactory kvmf,
this.messageBus = messageBus;
this.aclContextFactory = aclContextFactory;
KeyValueStorage storage = kvmf.getStorage();
this.prefix = storage.getPrefix() + "/clusters/";
String prefix = storage.getPrefix() + "/clusters/";
this.clusters = KvMap.builder(NodesGroup.class, AbstractNodesGroupConfig.class)
.path(prefix)
.mapper(kvmf)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public void setCluster(String cluster) {

private <T> void update(Supplier<T> getter, Consumer<T> setter, T value) {
NodeInfoImpl ni = null;
NodeInfoImpl oldInfo = null;
NodeInfoImpl oldInfo;
synchronized (lock) {
oldInfo = cache;
T oldVal = getter.get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
*/
@JtEnumLower
public enum ProtocolType {
TCP, UDP;
TCP, UDP
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.springframework.web.util.UrlPathHelper;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.TimeUnit;

Expand All @@ -45,6 +46,7 @@ public class UiConfiguration {
* @see WebSocketConfiguration
*/
static final String ALLOWED_ORIGIN = "*";
private final List<String> exports = Collections.singletonList("/ui/**");

@Bean
WebMvcConfigurerAdapter webMvcConfigurerAdapter(YAMLMapper yamlMapper) {
Expand Down Expand Up @@ -72,7 +74,7 @@ public void configurePathMatch(PathMatchConfigurer configurer) {

@Override
public void addCorsMappings(CorsRegistry registry) {
List<String> exports = Arrays.asList("/ui/**");

for(String prefix: exports) {
CorsRegistration cr = registry.addMapping(prefix);
cr.allowedOrigins(ALLOWED_ORIGIN);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public class BalancerConfiguration {
*/
@Bean
HttpProxy httpProxy() {
ProxyClient proxyClient = null;
ProxyClient proxyClient;
if (async) {
if (metricsEbanled) {
//Building HTTP Async client wrapper for gathering metrics
Expand Down

0 comments on commit ab76f83

Please sign in to comment.