2017-03-04 8 views
0

업데이트 : 어떤 이유로 실현하는 데 약간의 시간이 걸렸지 만 구성 파일은 번들 PID에만 해당되며 동일한 cfg 파일을로드하려고 시도합니다. 서로 다른 두 묶음 안에서 청사진을 만들고 경쟁 조건을 만들고있었습니다. 대상 번들에서만 cfg 파일을 사용해야합니다.Karaf v4.0.8 : 여러 청사진에서 동일한 영구 ID의 구성을로드 할 수 없습니다.

참고 : 위의 내용은 청사진 묶음에만 적용됩니다. 번들을 동적으로 유지하기 위해 OSGI ConfigAdmin 서비스에 의존하지 않고 Camel 컨텍스트와 같은 것으로부터 cfg 파일을 사용하려면 괜찮습니다.

2 개의 청사진이 karaf 4.0.8 'deploy'폴더를 통해 배포되었습니다. 둘 다 다음과 같은 공통 섹션이 있습니다.

<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" 
    xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation=" 
    http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd 
    http://camel.apache.org/schema/blueprint https://camel.apache.org/schema/blueprint/camel-blueprint.xsd"> 

    <cm:property-placeholder id="common" persistent-id="common" update-strategy="reload" placeholder-prefix="$(" placeholder-suffix=")"/> 

    <cm:property-placeholder id="sqlcfg" persistent-id="12345" update-strategy="reload" placeholder-prefix="$[" placeholder-suffix="]"> 
    </cm:property-placeholder> 

'공통'에서 둘 다 공통으로 구성을로드하고 싶습니다. 그러나 'etc'폴더에서 동일한 persistentId 및 properties 파일을 공유 할 때 두 번째로 배치 될 청사진은로드 및 언로드를 유지합니다. 파일을 다른 파일에서로드하면 모든 파일이로드됩니다.

커뮤니티에서 아이디어를 얻은 이유는 무엇입니까? 미리 감사드립니다.

답변

0

내 경험상 다른 영구 ID를 설정하거나 update-strategy = "none"으로 설정하십시오. 이렇게하면 두 번째 모듈이로드/언로드 루프에 빠지지 않습니다.

단점은 구성 파일의 자동 새로 고침이 손실된다는 것입니다.