Remove use of com.google.common.collect.Iterables
This commit removes all uses of com.google.common.collect.Iterables across the codebase. Relates elastic/elasticsearchelastic/elasticsearch#13224 Original commit: elastic/x-pack-elasticsearch@ca517de412
This commit is contained in:
parent
3676d6e370
commit
08de4a4ab1
|
@ -19,7 +19,6 @@ import org.elasticsearch.shield.authc.support.SecuredString;
|
||||||
|
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import static com.google.common.collect.Iterables.all;
|
|
||||||
import static java.util.Arrays.asList;
|
import static java.util.Arrays.asList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -147,8 +146,8 @@ public abstract class SessionFactory {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean allSecure = all(asList(ldapUrls), s -> STARTS_WITH_LDAPS.matcher(s).find());
|
boolean allSecure = asList(ldapUrls).stream().allMatch(s -> STARTS_WITH_LDAPS.matcher(s).find());
|
||||||
boolean allClear = all(asList(ldapUrls), s -> STARTS_WITH_LDAP.matcher(s).find());
|
boolean allClear = asList(ldapUrls).stream().allMatch(s -> STARTS_WITH_LDAP.matcher(s).find());
|
||||||
|
|
||||||
if (!allSecure && !allClear) {
|
if (!allSecure && !allClear) {
|
||||||
//No mixing is allowed because we use the same socketfactory
|
//No mixing is allowed because we use the same socketfactory
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.watcher.execution;
|
package org.elasticsearch.watcher.execution;
|
||||||
|
|
||||||
import com.google.common.collect.Iterables;
|
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.logging.ESLogger;
|
import org.elasticsearch.common.logging.ESLogger;
|
||||||
import org.elasticsearch.common.logging.Loggers;
|
import org.elasticsearch.common.logging.Loggers;
|
||||||
|
@ -14,6 +13,8 @@ import org.elasticsearch.watcher.trigger.TriggerEngine;
|
||||||
import org.elasticsearch.watcher.trigger.TriggerEvent;
|
import org.elasticsearch.watcher.trigger.TriggerEvent;
|
||||||
import org.elasticsearch.watcher.trigger.TriggerService;
|
import org.elasticsearch.watcher.trigger.TriggerService;
|
||||||
|
|
||||||
|
import java.util.stream.StreamSupport;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
public class AsyncTriggerListener implements TriggerEngine.Listener {
|
public class AsyncTriggerListener implements TriggerEngine.Listener {
|
||||||
|
@ -33,7 +34,7 @@ public class AsyncTriggerListener implements TriggerEngine.Listener {
|
||||||
try {
|
try {
|
||||||
executionService.processEventsAsync(events);
|
executionService.processEventsAsync(events);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("failed to process triggered events [{}]", e, (Object)Iterables.toArray(events, TriggerEvent.class));
|
logger.error("failed to process triggered events [{}]", e, (Object) StreamSupport.stream(events.spliterator(), false).toArray(size -> new TriggerEvent[size]));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.watcher.execution;
|
package org.elasticsearch.watcher.execution;
|
||||||
|
|
||||||
import com.google.common.collect.Iterables;
|
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.logging.ESLogger;
|
import org.elasticsearch.common.logging.ESLogger;
|
||||||
import org.elasticsearch.common.logging.Loggers;
|
import org.elasticsearch.common.logging.Loggers;
|
||||||
|
@ -14,6 +13,8 @@ import org.elasticsearch.watcher.trigger.TriggerEngine;
|
||||||
import org.elasticsearch.watcher.trigger.TriggerEvent;
|
import org.elasticsearch.watcher.trigger.TriggerEvent;
|
||||||
import org.elasticsearch.watcher.trigger.TriggerService;
|
import org.elasticsearch.watcher.trigger.TriggerService;
|
||||||
|
|
||||||
|
import java.util.stream.StreamSupport;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
public class SyncTriggerListener implements TriggerEngine.Listener {
|
public class SyncTriggerListener implements TriggerEngine.Listener {
|
||||||
|
@ -33,7 +34,7 @@ public class SyncTriggerListener implements TriggerEngine.Listener {
|
||||||
try {
|
try {
|
||||||
executionService.processEventsSync(events);
|
executionService.processEventsSync(events);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("failed to process triggered events [{}]", e, (Object)Iterables.toArray(events, TriggerEvent.class));
|
logger.error("failed to process triggered events [{}]", e, (Object) StreamSupport.stream(events.spliterator(), false).toArray(size -> new TriggerEvent[size]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ import com.fasterxml.jackson.core.io.JsonStringEncoder;
|
||||||
import com.github.mustachejava.DefaultMustacheFactory;
|
import com.github.mustachejava.DefaultMustacheFactory;
|
||||||
import com.github.mustachejava.MustacheException;
|
import com.github.mustachejava.MustacheException;
|
||||||
import com.github.mustachejava.reflect.ReflectionObjectHandler;
|
import com.github.mustachejava.reflect.ReflectionObjectHandler;
|
||||||
import com.google.common.collect.Iterables;
|
import org.elasticsearch.common.util.iterable.Iterables;
|
||||||
import org.elasticsearch.common.xcontent.XContentType;
|
import org.elasticsearch.common.xcontent.XContentType;
|
||||||
import org.elasticsearch.watcher.support.ArrayObjectIterator;
|
import org.elasticsearch.watcher.support.ArrayObjectIterator;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue