Skip to content

Commit

Permalink
If the api call to get system metadata have a service failure excepti…
Browse files Browse the repository at this point in the history
…on, indexer will try again.
  • Loading branch information
taojing2002 committed Apr 25, 2024
1 parent d06ac51 commit 42c493d
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/main/java/org/dataone/cn/indexer/object/ObjectManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,22 @@ public SystemMetadata getSystemMetadata(String id, String relativeObjPath) throw
Identifier identifier = new Identifier();
identifier.setValue(id);
try {
sysmeta = d1Node.getSystemMetadata(session, identifier);
for (int i=0; i<5; i++) {
try {
sysmeta = d1Node.getSystemMetadata(session, identifier);
break;
} catch (ServiceFailure ee) {
logger.warn("The DataONE api call doesn't get the system metadata since "
+ ee.getMessage() + ". This is " + i
+ " try and Indexer will try again.");
try {
Thread.sleep(300);
} catch (InterruptedException ie) {
logger.info("The sleep of the thread was interrupted.");
}
continue;
}
}
logger.debug("ObjectManager.getSystemMetadata - finish getting the system metadata via the DataONE API call for the pid " + id);
} catch (NotAuthorized e) {
logger.info("ObjectManager.getSystemMetadata - failed to get the system metadata via the DataONE API call for the pid " + id +
Expand Down

0 comments on commit 42c493d

Please sign in to comment.