Skip to content

Commit 072783d

Browse files
rishabhdaimRishabh Kumar
andauthored
OAK-11381 : removed usage of Guava's Maps.asMap (#1972)
Co-authored-by: Rishabh Kumar <diam@adobe.com>
1 parent 02fe3d1 commit 072783d

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/ActiveDeletedBlobCollectorMBeanImpl.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
package org.apache.jackrabbit.oak.plugins.index.lucene;
2121

22-
import org.apache.jackrabbit.guava.common.collect.Maps;
2322
import org.apache.jackrabbit.oak.api.CommitFailedException;
2423
import org.apache.jackrabbit.oak.api.jmx.CheckpointMBean;
2524
import org.apache.jackrabbit.oak.api.jmx.IndexStatsMBean;
@@ -47,6 +46,7 @@
4746
import java.util.concurrent.Callable;
4847
import java.util.concurrent.Executor;
4948
import java.util.concurrent.TimeUnit;
49+
import java.util.function.Function;
5050
import java.util.stream.Collectors;
5151
import java.util.stream.StreamSupport;
5252

@@ -212,25 +212,25 @@ public void flagActiveDeletionSafe() {
212212
* @return true if all running index cycles have been through; false otherwise
213213
*/
214214
private boolean waitForRunningIndexCycles() {
215-
Map<IndexStatsMBean, Long> origIndexLaneToExecutinoCountMap = Maps.asMap(
216-
new HashSet<>(StreamSupport.stream(asyncIndexInfoService.getAsyncLanes().spliterator(), false)
217-
.map(lane -> asyncIndexInfoService.getInfo(lane).getStatsMBean())
218-
.filter(bean -> {
219-
String beanStatus;
220-
try {
221-
if (bean != null) {
222-
beanStatus = bean.getStatus();
223-
} else {
224-
return false;
225-
}
226-
} catch (Exception e) {
227-
LOG.warn("Exception during getting status for {}. Ignoring this indexer lane", bean.getName(), e);
228-
return false;
229-
}
230-
return STATUS_RUNNING.equals(beanStatus);
231-
})
232-
.collect(Collectors.toList())),
233-
IndexStatsMBean::getTotalExecutionCount);
215+
Map<IndexStatsMBean, Long> origIndexLaneToExecutinoCountMap = new HashSet<>(StreamSupport.stream(asyncIndexInfoService.getAsyncLanes().spliterator(), false)
216+
.map(lane -> asyncIndexInfoService.getInfo(lane).getStatsMBean())
217+
.filter(bean -> {
218+
String beanStatus;
219+
try {
220+
if (bean != null) {
221+
beanStatus = bean.getStatus();
222+
} else {
223+
return false;
224+
}
225+
} catch (Exception e) {
226+
LOG.warn("Exception during getting status for {}. Ignoring this indexer lane", bean.getName(), e);
227+
return false;
228+
}
229+
return STATUS_RUNNING.equals(beanStatus);
230+
})
231+
.collect(Collectors.toList()))
232+
.stream()
233+
.collect(Collectors.toMap(Function.identity(), IndexStatsMBean::getTotalExecutionCount));
234234

235235
if (!origIndexLaneToExecutinoCountMap.isEmpty()) {
236236
LOG.info("Found running index lanes ({}). Sleep a bit before continuing.",

oak-security-spi/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/credentials/SimpleCredentialsSupport.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
import java.util.Collections;
2020
import java.util.Map;
2121
import java.util.Set;
22+
import java.util.function.Function;
23+
import java.util.stream.Collectors;
2224

2325
import javax.jcr.Credentials;
2426
import javax.jcr.SimpleCredentials;
2527

26-
import org.apache.jackrabbit.guava.common.collect.Maps;
27-
2828
import org.jetbrains.annotations.NotNull;
2929
import org.jetbrains.annotations.Nullable;
3030

@@ -64,7 +64,7 @@ public String getUserId(@NotNull Credentials credentials) {
6464
public Map<String, ?> getAttributes(@NotNull Credentials credentials) {
6565
if (credentials instanceof SimpleCredentials) {
6666
final SimpleCredentials sc = (SimpleCredentials) credentials;
67-
return Maps.asMap(Set.of(sc.getAttributeNames()), sc::getAttribute);
67+
return Set.of(sc.getAttributeNames()).stream().collect(Collectors.toMap(Function.identity(), sc::getAttribute));
6868
} else {
6969
return Collections.emptyMap();
7070
}

0 commit comments

Comments
 (0)