[ 
https://issues.apache.org/jira/browse/NIFI-2142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15397807#comment-15397807
 ] 

ASF GitHub Bot commented on NIFI-2142:
--------------------------------------

Github user JPercivall commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/609#discussion_r72658633
  
    --- Diff: 
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/TransformXml.java
 ---
    @@ -168,15 +168,18 @@ protected PropertyDescriptor 
getSupportedDynamicPropertyDescriptor(final String
     
         @OnScheduled
         public void onScheduled(final ProcessContext context) {
    -        final Long cacheSize = context.getProperty(CACHE_SIZE).asLong();
    -        final Long cacheDuration = 
context.getProperty(CACHE_DURATION).asTimePeriod(TimeUnit.SECONDS);
    -
    -        CacheBuilder cacheBuilder = CacheBuilder.newBuilder();
    -        if (cacheSize > 0) {
    -            cacheBuilder = cacheBuilder.maximumSize(cacheSize);
    -            if (cacheDuration > 0) {
    -                cacheBuilder = 
cacheBuilder.expireAfterAccess(cacheDuration, TimeUnit.SECONDS);
    -            }
    +        final ComponentLog logger = getLogger();
    +        final Integer cacheSize = 
context.getProperty(CACHE_SIZE).asInteger();
    +        final Long cacheTTL = 
context.getProperty(CACHE_TTL_AFTER_LAST_ACCESS).asTimePeriod(TimeUnit.SECONDS);
    +
    +        CacheBuilder cacheBuilder = 
CacheBuilder.newBuilder().maximumSize(cacheSize);
    +
    +        if (cacheSize <= 0) {
    +            logger.warn("Stylesheet cache disabled because cache size is 
set to 0");
    --- End diff --
    
    The cache will still be created and on line 213 it will try to use it to 
look up an xslt if the cache size is 0. I'd suggest not even creating it in 
that case.


> Cache compiled XSLT in TransformXml
> -----------------------------------
>
>                 Key: NIFI-2142
>                 URL: https://issues.apache.org/jira/browse/NIFI-2142
>             Project: Apache NiFi
>          Issue Type: Improvement
>            Reporter: Joey Frazee
>             Fix For: 1.0.0
>
>         Attachments: NIFI-2142 TransformXml Data Flow.png
>
>
> TransformXml appears to be recompiling the XSLT on every onTrigger event, 
> which is slow. It should cache the compiled stylesheets.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to