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

ASF GitHub Bot commented on TINKERPOP-1644:
-------------------------------------------

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

    https://github.com/apache/tinkerpop/pull/570#discussion_r105764358
  
    --- Diff: 
gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/CompilationOptionsCustomizer.java
 ---
    @@ -0,0 +1,39 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + * http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +package org.apache.tinkerpop.gremlin.groovy.jsr223;
    +
    +import org.apache.tinkerpop.gremlin.jsr223.Customizer;
    +
    +/**
    + * Provides some custom compilation options to the {@link 
GremlinGroovyScriptEngine}.
    + *
    + * @author Stephen Mallette (http://stephen.genoprime.com)
    + */
    +class CompilationOptionsCustomizer implements Customizer {
    +
    +    private final int expectedCompilationTime;
    +
    +    public CompilationOptionsCustomizer(final int expectedCompilationTime) 
{
    --- End diff --
    
    I believe `int` should be `Integer` looking at the other customizers.  
However, there seems to be issues with customizers in general where in 3.2.5 
they are deprecated and no longer public classes. So when I modify this class 
with Integer, (or try to use the newer, non 'customizer' package customizers) I 
get the following error.
    
    ```
          compilerCustomizerProviders: {
                  
"org.apache.tinkerpop.gremlin.groovy.jsr223.CompilationOptionsCustomizer":[1]}
    ```
    Error:
    ```
    [WARN] ScriptEngines - Could not instantiate CompilerCustomizerProvider 
implementation 
[org.apache.tinkerpop.gremlin.groovy.jsr223.CompilationOptionsCustomizer].  It 
will not be applied.
    java.lang.IllegalAccessException: Class 
org.apache.tinkerpop.gremlin.groovy.engine.ScriptEngines can not access a 
member of class 
org.apache.tinkerpop.gremlin.groovy.jsr223.CompilationOptionsCustomizer with 
modifiers "public"
        at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:102)
        at 
java.lang.reflect.AccessibleObject.slowCheckMemberAccess(AccessibleObject.java:296)
        at 
java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:288)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:413)
        at 
org.apache.tinkerpop.gremlin.groovy.engine.ScriptEngines.lambda$createScriptEngine$15(ScriptEngines.java:416)
        at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
        at 
org.apache.tinkerpop.gremlin.groovy.engine.ScriptEngines.createScriptEngine(ScriptEngines.java:399)
        at 
org.apache.tinkerpop.gremlin.groovy.engine.ScriptEngines.reload(ScriptEngines.java:187)
    ```


> Improve script compilation process and include metrics
> ------------------------------------------------------
>
>                 Key: TINKERPOP-1644
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1644
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: groovy
>    Affects Versions: 3.2.4
>            Reporter: Bryn Cooke
>            Assignee: stephen mallette
>
> Currently there is no synchronisation around script compilation. This means 
> that if a particularly heavy script is in use, many threads may end up 
> compiling the same script.
> It would seem like a good idea to have some some sort of synchronisation to 
> prevent ever getting to this stage.
> In addition, there will be cases where users will repeatedly submit broken 
> scripts to the server. In this case it is useful to log the error the first 
> time the script compilation is attempted and then cache the error for 
> subsequent runs.
> Finally I have found some scripts take in excess of 30 seconds to compile. To 
> aid performance debugging the script compilation times should be included in 
> the logs.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to