Skip to content
This repository has been archived by the owner on Jul 11, 2022. It is now read-only.

Commit

Permalink
Wait and retrieve backing content if the getPackageBits fails
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenvp8510 committed Sep 15, 2017
1 parent 3249801 commit 4e36884
Showing 1 changed file with 19 additions and 2 deletions.
Expand Up @@ -637,9 +637,26 @@ public void retrieveBackingContent(String fileName) throws IOException {
}

File file = new File(fileName);
long start = System.currentTimeMillis();

byte[] data = null;

while(System.currentTimeMillis() - start < 120000) {
try {
data = remoteClient.getProxy(ContentManagerRemote.class).getPackageBytes(
remoteClient.getSubject(), resourceClientProxy.resourceId, installedPackage.getId());
break;
} catch (RuntimeException e){
// The installed package Id could be changed by the purge job or the deploy process.
// So we get it again and try to get the bits with the new id (if it changes)
installedPackage = getBackingContent();
continue;
}
}

byte[] data = remoteClient.getProxy(ContentManagerRemote.class).getPackageBytes(
remoteClient.getSubject(), resourceClientProxy.resourceId, installedPackage.getId());
if (data == null) {
throw new RuntimeException("Unable to retrieve package bits package " + installedPackage.getId() );
}

FileOutputStream fos = new FileOutputStream(file);
try {
Expand Down

0 comments on commit 4e36884

Please sign in to comment.