@@ -163,12 +163,22 @@ private class HeartbeatProcess implements Runnable
163
163
@ Override
164
164
public void run ( )
165
165
{
166
- writeNodeStatus ();
167
- readNodeStatuses ();
168
- purgeOutdatedNodes ();
166
+ try
167
+ {
168
+ writeNodeStatus ();
169
+ readNodeStatuses ();
170
+ purgeOutdatedNodes ();
171
+ lastError = null ;
172
+ }
173
+ catch ( final PwmUnrecoverableException e )
174
+ {
175
+ lastError = e .getErrorInformation ();
176
+ LOGGER .error ( e .getErrorInformation () );
177
+ }
169
178
}
170
179
171
180
void writeNodeStatus ( )
181
+ throws PwmUnrecoverableException
172
182
{
173
183
try
174
184
{
@@ -180,12 +190,12 @@ void writeNodeStatus( )
180
190
{
181
191
final String errorMsg = "error writing node service heartbeat: " + e .getMessage ();
182
192
final ErrorInformation errorInformation = new ErrorInformation ( PwmError .ERROR_NODE_SERVICE_ERROR , errorMsg );
183
- lastError = errorInformation ;
184
- LOGGER .error ( lastError );
193
+ throw new PwmUnrecoverableException ( errorInformation );
185
194
}
186
195
}
187
196
188
197
void readNodeStatuses ( )
198
+ throws PwmUnrecoverableException
189
199
{
190
200
try
191
201
{
@@ -197,12 +207,12 @@ void readNodeStatuses( )
197
207
{
198
208
final String errorMsg = "error reading node statuses: " + e .getMessage ();
199
209
final ErrorInformation errorInformation = new ErrorInformation ( PwmError .ERROR_NODE_SERVICE_ERROR , errorMsg );
200
- lastError = errorInformation ;
201
- LOGGER .error ( lastError );
210
+ throw new PwmUnrecoverableException ( errorInformation );
202
211
}
203
212
}
204
213
205
214
void purgeOutdatedNodes ( )
215
+ throws PwmUnrecoverableException
206
216
{
207
217
try
208
218
{
@@ -213,8 +223,7 @@ void purgeOutdatedNodes( )
213
223
{
214
224
final String errorMsg = "error purging outdated node reference: " + e .getMessage ();
215
225
final ErrorInformation errorInformation = new ErrorInformation ( PwmError .ERROR_NODE_SERVICE_ERROR , errorMsg );
216
- lastError = errorInformation ;
217
- LOGGER .error ( lastError );
226
+ throw new PwmUnrecoverableException ( errorInformation );
218
227
}
219
228
}
220
229
}
0 commit comments