Commit 4177e8e
committed
Improve data store handling with thread safety and resource management enhancements
This commit addresses several improvements in the data store processing implementation:
**Thread Safety Improvements:**
- DataStoreFactory: Changed dataStoreMap from LinkedHashMap to ConcurrentHashMap for thread-safe concurrent access
- DataStoreFactory: Made dataStoreNames and lastLoadedTime volatile to ensure visibility across threads
- DataStoreFactory: Made getDataStoreNames() synchronized to prevent race conditions during cache refresh
- AbstractDataStore: Made alive field volatile to ensure proper visibility in multi-threaded scenarios
- FileListIndexUpdateCallbackImpl: Changed deleteUrlList from ArrayList to CopyOnWriteArrayList for thread-safe access from executor threads
**Resource Handling:**
- DataStoreFactory: Added null check for jarFiles array to prevent NullPointerException
- DataStoreFactory: Added existence check for XML configuration files before attempting to read them, reducing unnecessary exception handling
**Code Quality:**
- AbstractDataStore: Moved static logger declaration before instance fields following Java best practices
- FileListIndexUpdateCallbackImpl: Fixed incorrect StringUtil import (was using Apache POI's StringUtil instead of Fess's)
These improvements enhance the reliability and thread safety of the data store processing layer,
particularly important for concurrent crawling operations.1 parent 7a00060 commit 4177e8e
File tree
3 files changed
+29
-15
lines changed- src/main/java/org/codelibs/fess/ds
- callback
3 files changed
+29
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | 46 | | |
54 | 47 | | |
55 | 48 | | |
| |||
64 | 57 | | |
65 | 58 | | |
66 | 59 | | |
| 60 | + | |
67 | 61 | | |
68 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
| 68 | + | |
67 | 69 | | |
68 | | - | |
| 70 | + | |
69 | 71 | | |
70 | 72 | | |
71 | 73 | | |
72 | 74 | | |
73 | 75 | | |
74 | | - | |
| 76 | + | |
75 | 77 | | |
76 | 78 | | |
77 | 79 | | |
78 | 80 | | |
| 81 | + | |
79 | 82 | | |
80 | | - | |
| 83 | + | |
81 | 84 | | |
82 | 85 | | |
83 | 86 | | |
| |||
130 | 133 | | |
131 | 134 | | |
132 | 135 | | |
133 | | - | |
| 136 | + | |
134 | 137 | | |
135 | 138 | | |
136 | 139 | | |
| |||
154 | 157 | | |
155 | 158 | | |
156 | 159 | | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
157 | 163 | | |
158 | 164 | | |
159 | 165 | | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
160 | 172 | | |
161 | 173 | | |
162 | 174 | | |
| |||
Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
37 | | - | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
89 | 90 | | |
90 | 91 | | |
91 | 92 | | |
92 | | - | |
93 | | - | |
| 93 | + | |
| 94 | + | |
94 | 95 | | |
95 | 96 | | |
96 | 97 | | |
| |||
0 commit comments