Skip to content

Commit 87b4d24

Browse files
committed
fix issue #518 - Error purging outdated node reference
1 parent 10bfea9 commit 87b4d24

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

server/src/main/java/password/pwm/svc/node/NodeMachine.java

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,22 @@ private class HeartbeatProcess implements Runnable
163163
@Override
164164
public void run( )
165165
{
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+
}
169178
}
170179

171180
void writeNodeStatus( )
181+
throws PwmUnrecoverableException
172182
{
173183
try
174184
{
@@ -180,12 +190,12 @@ void writeNodeStatus( )
180190
{
181191
final String errorMsg = "error writing node service heartbeat: " + e.getMessage();
182192
final ErrorInformation errorInformation = new ErrorInformation( PwmError.ERROR_NODE_SERVICE_ERROR, errorMsg );
183-
lastError = errorInformation;
184-
LOGGER.error( lastError );
193+
throw new PwmUnrecoverableException( errorInformation );
185194
}
186195
}
187196

188197
void readNodeStatuses( )
198+
throws PwmUnrecoverableException
189199
{
190200
try
191201
{
@@ -197,12 +207,12 @@ void readNodeStatuses( )
197207
{
198208
final String errorMsg = "error reading node statuses: " + e.getMessage();
199209
final ErrorInformation errorInformation = new ErrorInformation( PwmError.ERROR_NODE_SERVICE_ERROR, errorMsg );
200-
lastError = errorInformation;
201-
LOGGER.error( lastError );
210+
throw new PwmUnrecoverableException( errorInformation );
202211
}
203212
}
204213

205214
void purgeOutdatedNodes( )
215+
throws PwmUnrecoverableException
206216
{
207217
try
208218
{
@@ -213,8 +223,7 @@ void purgeOutdatedNodes( )
213223
{
214224
final String errorMsg = "error purging outdated node reference: " + e.getMessage();
215225
final ErrorInformation errorInformation = new ErrorInformation( PwmError.ERROR_NODE_SERVICE_ERROR, errorMsg );
216-
lastError = errorInformation;
217-
LOGGER.error( lastError );
226+
throw new PwmUnrecoverableException( errorInformation );
218227
}
219228
}
220229
}

0 commit comments

Comments
 (0)