We're sorry GroupDocs doesn't work properply without JavaScript enabled.

Free Support Forum - groupdocs.com

Document merger API - Applying license taking long time in Java

We have a use case that we have to bring up a java application every time we have to process a file. That means we have to apply for a license every time as well. But we have found that applying Group docs merger license takes a long time.

I have attached the machine specs here and it’s quite a decent one. Usually, we will have lower spec machines where it will be running.

Please find the logs below:

2021-10-23 11:05:51.423 DEBUG 17816 — [main] ####.LicRegisterConfig : =========Registering Licenses=========
2021-10-23 11:05:51.458 DEBUG 17816 — [main] ####.LicRegisterConfig : Fetching license -> GroupDocs …
2021-10-23 11:05:51.730 DEBUG 17816 — [main] ####.LicRegisterConfig : Done.
2021-10-23 11:05:57.284 DEBUG 17816 — [main] ####.LicRegisterConfig : License applied Group docs => true
2021-10-23 11:05:57.294 DEBUG 17816 — [main] ####.LicRegisterConfig : Fetching license -> Aspose …
2021-10-23 11:05:57.313 DEBUG 17816 — [main] ####.LicRegisterConfig : Done.
2021-10-23 11:05:57.518 DEBUG 17816 — [main] ####.LicRegisterConfig : License applied cells => true
2021-10-23 11:05:58.622 DEBUG 17816 — [main] ####.LicRegisterConfig : License applied pdf => true
2021-10-23 11:05:59.411 DEBUG 17816 — [main] ####.LicRegisterConfig : License applied words=> true
2021-10-23 11:05:59.472 DEBUG 17816 — [main] ####.LicRegisterConfig : License applied pptx => true

Code to apply lic:

private String getLicense(String type){

log.debug(“Fetching license -> {} …”, type);
File temp = File.createTempFile(UUID.randomUUID().toString(), “.lic”);
temp.deleteOnExit();
BufferedWriter out = new BufferedWriter(new FileWriter(temp));
String lic = encryptionService.getDecryptValue(licenseValue, null);
out.write(lic);
out.close();
log.debug(“Done.”);
return temp.getAbsolutePath();

}

License license = new License();
license.setLicense(getLicense(groupDocsMergerLic, “GroupDocs”));


Please advise on how to reduce this time. We can’t afford to spend this long on just license processing.

image.png (17.3 KB)

@sushil8282

We’re looking into this scenario. Your investigation ticket ID is MERGERJAVA-939. We’ll let you know if any further details are required.

Hi there, any updates on this?

@sushil8282

Setting license time cannot be decreased for now. Usually, the license is setup once for all the actions. Please add public static bool isLicensed() property for the corresponding class and set it up to true after licenses are setup and use it later:

if (!isLicensed()) {
    License license = new License();
    license.setLicense(getLicense(groupDocsMergerLic, “GroupDocs”));
    isLicensed() = true;
}