1 /**
2 * Copyright Terracotta, Inc.
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
17 /**
18 *
19 */
20 package net.sf.ehcache.store.disk;
21
22 import net.sf.ehcache.pool.sizeof.annotations.IgnoreSizeOf;
23 import net.sf.ehcache.store.disk.DiskStorageFactory.DiskSubstitute;
24
25 /**
26 * Internal entry structure used by the {@link net.sf.ehcache.store.disk.Segment} class.
27 *
28 * @author Chris Dennis
29 * @author Ludovic Orban
30 */
31 final class HashEntry {
32
33 /**
34 * Key instance for this mapping.
35 */
36 @IgnoreSizeOf
37 protected final Object key;
38
39 /**
40 * Spread hash value for they key.
41 */
42 protected final int hash;
43
44 /**
45 * Reference to the next HashEntry in this chain.
46 */
47 @IgnoreSizeOf
48 protected final HashEntry next;
49
50 /**
51 * Reference to the DiskSubstitute for this entry.
52 */
53 protected volatile DiskSubstitute element;
54
55 /**
56 * Constructs a HashEntry instance mapping the supplied key, value pair
57 * and linking it to the supplied HashEntry
58 *
59 * @param key key for this entry
60 * @param hash spread-hash for this entry
61 * @param next next HashEntry in the chain
62 * @param element initial value for this entry
63 */
64 HashEntry(Object key, int hash, HashEntry next, DiskSubstitute element) {
65 this.key = key;
66 this.hash = hash;
67 this.next = next;
68 this.element = element;
69 }
70 }
71