• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ben-manes / caffeine / #5173

29 Dec 2025 05:27AM UTC coverage: 0.0% (-100.0%) from 100.0%
#5173

push

github

ben-manes
speed up development ci build

0 of 3838 branches covered (0.0%)

0 of 7869 relevant lines covered (0.0%)

0.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/caffeine/src/main/java/com/github/benmanes/caffeine/cache/WriteThroughEntry.java
1
/*
2
 * Copyright 2015 Ben Manes. All Rights Reserved.
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
package com.github.benmanes.caffeine.cache;
17

18
import static java.util.Objects.requireNonNull;
19

20
import java.util.AbstractMap.SimpleEntry;
21
import java.util.concurrent.ConcurrentMap;
22

23
/**
24
 * An entry that allows updates to write through to the backing map.
25
 *
26
 * @author ben.manes@gmail.com (Ben Manes)
27
 */
28
final class WriteThroughEntry<K, V> extends SimpleEntry<K, V> {
29
  private static final long serialVersionUID = 1;
30

31
  @SuppressWarnings("serial")
32
  private final ConcurrentMap<K, V> map;
33

34
  WriteThroughEntry(ConcurrentMap<K, V> map, K key, V value) {
35
    super(key, value);
×
36
    this.map = requireNonNull(map);
×
37
  }
×
38

39
  @Override
40
  public V setValue(V value) {
41
    // See ConcurrentHashMap: "Sets our entry's value and writes through to the map. The value to
42
    // return is somewhat arbitrary here. Since we do not necessarily track asynchronous changes,
43
    // the most recent "previous" value could be different from what we return (or could even have
44
    // been removed, in which case the put will re-establish). We do not and cannot guarantee more."
45
    map.put(getKey(), value);
×
46
    return super.setValue(value);
×
47
  }
48

49
  Object writeReplace() {
50
    return new SimpleEntry<>(this);
×
51
  }
52
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc