Highlighted

Problem with shared OSGi shared service and it's configurations

Avatar

Avatar

GK-AEM

Avatar

GK-AEM

GK-AEM

26-09-2019

Hi All,

We are facing a critical issue that have 2 schedulers for 2 different applications. Where scheduler 1(Service-1) is the main scheduler another one(Service-2) just overrides the scheduler1 gets executed based set Cron expression and have their respective OSGi configurations. Here the problem, whenever we run the scheduler -1 whatever config values set for scheduler-2 are being considered instead of configs of scheduler-1.

Not sure how to fix this issue and how to make them available to respective schedulers.

Below is the snippet of Scheduler -2 service's extending classes definition:

@Component(metatype = true, immediate = true, enabled = true, label = "XXX SiteMap XML Generator Scheduler",

        description = "Display SiteMap XML Generator Config")

@Service(value = Runnable.class)

public class YYYSearchIndexScheduler extends XXXSearchIndexScheduler{

  

  @Reference(target = "(process.label=YYY Mapping Service)")

  protected XXXSearchService dcomSearchService;

 

  /** The resolver factory. */

  @Reference(policy = ReferencePolicy.STATIC)

  protected ResourceResolverFactory resolverFactory;

 

  /**

   * Sets domain specific properties.

   */

  @Override

  protected void setDomainSpecificProperties() {

  dComSearchConfigBean.setDomain(CommonConstants.DOMAIN_ZZZZ_DIGITAL);

  dComSearchConfigBean.setContentRootPath(CommonConstants.CONTENT_ZZZ_DIGITAL);

  dComSearchConfigBean.setSitemapDAMLocation(CommonConstants.DD_SITEMAP_DAM_LOCATION);

  dComSearchConfigBean.setSitemapFolderTitle(CommonConstants.DD_SITEMAP_FOLDER_TITLE);

  dComSearchConfigBean.setSnpDAMLocation(CommonConstants.DD_SNP_DAM_LOCATION);

  dComSearchConfigBean.setSnpFolderTitle(CommonConstants.DAM_SNP_FOLDER_TITLE);

  }

}

/**

* The Class SitemapMappingServiceImpl.

*/

@Component(metatype = true, immediate = true, enabled = true, label = "YYY Sitemap and SNP Mapping Service",

description = "YYY Sitemap and SNP Mapping Service to get common properties")

@Properties({

@Property(unbounded = PropertyUnbounded.ARRAY, label = "Sitemap Member Firm",

        description = "Sitemap Member Firm", name = CommonConstants.SITEMAP_MEMBER_FIRMS, value = {}),

@Property(unbounded = PropertyUnbounded.ARRAY, label = "Sitemap Allowed Templates",

description = "Sitemap Allowed Templates", name = CommonConstants.SITEMAP_ALLOWED_TEMPLATES, value = {}),

@Property(unbounded = PropertyUnbounded.ARRAY, label = "SNP Allowed Templates",

        description = "SNP Allowed Templates", name = CommonConstants.SNP_ALLOWED_TEMPLATES, value = {},propertyPrivate = true),

    @Property(unbounded = PropertyUnbounded.ARRAY, label = "SNP Member Firm", description = "SNP Member Firm",

        name = CommonConstants.SNP_MEMBER_FIRMS, value = {},propertyPrivate = true),

    @Property(name = "process.label", value = "DDCom Mapping Service", propertyPrivate = true)

})

@Service

public class YYYSearchServiceImpl extends XXXSearchServiceImpl {

}

Any quick help is appreciated.

Thanks,

GK