Hi all,

Current script mediator implementation depends on apache-commons-bsf-3.0 to
get the script engines for Rhino, Ruby, Groovy and Jython [1][2]. However,
moving forward if we are to support newer Rhino and Nashorn (for Java 8) we
can directly use these engines or any other implementation of our own by
extending javax.script.ScriptEngine and javax.script.ScriptEngineFactory
respectively. We only need to register these with the
javax.script.ScriptEngineManager. We can for the moment support newer
version of Rhino and Nashorn as new script engines (by defining a new
parameter value to select the engine) so as to not break the existing
stories.

Are we aware of all the limitations of Rhino at the moment? Is it only the
64KB limitation that we are focusing on?

[1] http://commons.apache.org/proper/commons-bsf/
[2]
https://github.com/wso2/wso2-synapse/blob/master/modules/extensions/src/main/java/org/apache/synapse/mediators/bsf/ScriptMediator.java
: initScriptEngine() method

Thanks,
Maheeka


Maheeka Jayasuriya
Software Engineer
Mobile : +94777750661

On Mon, Apr 11, 2016 at 12:55 PM, Prabath Ariyarathna <prabat...@wso2.com>
wrote:

> @PrabathAR - Can you give us more details on this please?
>
> Inside Rhino engine, we can set optimization levels[1] which change the
> behavior of the engine. Default level is 0 and no optimizations are
> performed, but we can set this level in between -1 and 9 for the different
> optimizations. We can set this level to  -1 which Rhino switch into the
> interpreted mode, which means that it goes down to a different path for
> executing the code than it does in compiled mode. Interpreted mode is, of
> course, slower than compiled mode but improvement from the memory usage
> side[2].
> If we can give the optimization level in a configurable way we can
> overcome this issue.
>
> But +1 for adding new Rhino version if issue already fixed it in the
> later version. However we can check the possibility of adding configurable
> optimization levels.
>
> [1]
> https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Rhino/Optimization
> [2]
> http://stackoverflow.com/questions/14538541/performance-of-the-compiled-vs-interpreted-javascript-in-java7-rhino
>
> Thanks.
>
> On Mon, Apr 11, 2016 at 12:34 PM, Vanjikumaran Sivajothy <va...@wso2.com>
> wrote:
>
>> With JDK 8, there is an in-build JS engine called Nashorn. Isn't that
>> worth to leverage the JS support by using native implementation to JDK 8?
>>
>>
>> [1]
>> http://www.oracle.com/technetwork/articles/java/jf14-nashorn-2126515.html
>>
>> On Sun, Apr 10, 2016 at 11:57 PM, Malaka Silva <mal...@wso2.com> wrote:
>>
>>> PrabathAR has already found a way to support this using existing rhino
>>> version. There is a configuration to optimize the execution.
>>>
>>> @PrabathAR - Can you give us more details on this please?
>>>
>>> On Mon, Apr 11, 2016 at 12:22 PM, Nuwan Pallewela <nuw...@wso2.com>
>>> wrote:
>>>
>>>> Hi All,
>>>>
>>>> There is a limitation in wso2 script mediator when we try to manipulate
>>>> payloads with JavaScript as the scripting language, when the Payload size
>>>> is larger than 64KB, ESB throws an exception. Cause for this is Rhino
>>>> version which is used by the script mediator has a limitation of handling
>>>> JavaScript objects of size 64KB or more. But rhino have fixed it in the
>>>> later versions. So we can include new rhino and nashorn engines as the
>>>> script engine for JS in script mediator and avoid the limitation of
>>>> handling larger payloads.
>>>> Can we do this improvement to ESB 5.0.0 release?
>>>>
>>>> Thanks,
>>>> Nuwan
>>>>
>>>> --
>>>> ----------------------------------------------------------
>>>>
>>>> *Nuwan Chamara Pallewela*
>>>>
>>>>
>>>> *Software Engineer*
>>>>
>>>> *WSO2, Inc. *http://wso2.com
>>>> *lean . enterprise . middleware*
>>>>
>>>> Email   *nuw...@wso2.com <nuw...@wso2.com>*
>>>> Mobile  *+94719079739 <%2B94719079739>@*
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Architecture mailing list
>>>> Architecture@wso2.org
>>>> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>>>>
>>>>
>>>
>>>
>>> --
>>>
>>> Best Regards,
>>>
>>> Malaka Silva
>>> Senior Tech Lead
>>> M: +94 777 219 791
>>> Tel : 94 11 214 5345
>>> Fax :94 11 2145300
>>> Skype : malaka.sampath.silva
>>> LinkedIn : http://www.linkedin.com/pub/malaka-silva/6/33/77
>>> Blog : http://mrmalakasilva.blogspot.com/
>>>
>>> WSO2, Inc.
>>> lean . enterprise . middleware
>>> http://www.wso2.com/
>>> http://www.wso2.com/about/team/malaka-silva/
>>> <http://wso2.com/about/team/malaka-silva/>
>>> https://store.wso2.com/store/
>>>
>>> Save a tree -Conserve nature & Save the world for your future. Print
>>> this email only if it is absolutely necessary.
>>>
>>> _______________________________________________
>>> Architecture mailing list
>>> Architecture@wso2.org
>>> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>>>
>>>
>>
>>
>> --
>> Vanjikumaran Sivajothy
>> *Associate Technical Lead*
>> *WSO2 Inc. http://wso2.com <http://wso2.com/>*
>>  *+1-925-464-6816*
>> [image: Facebook] <https://www.facebook.com/vanjikumaran> [image:
>> Twitter] <https://twitter.com/vanjikumaran> [image: LinkedIn]
>> <http://www.linkedin.com/pub/vanjikumaran-sivajothy/25/b31/293> [image:
>> Blogger] <http://vanjikumaran.blogspot.com/> [image: SlideShare]
>> <http://www.slideshare.net/vanjikumaran>
>>
>> This communication may contain privileged or other
>> confidential information and is intended exclusively for the addressee/s.
>> If you are not the intended recipient/s, or believe that you may
>> have received this communication in error, please reply to the
>> sender indicating that fact and delete the copy you received and in
>> addition, you should not print, copy, re-transmit, disseminate, or
>> otherwise use the information contained in this communication.
>> Internet communications cannot be guaranteed to be timely, secure, error
>> or virus-free. The sender does not accept liability for any errors
>> or omissions
>>
>> _______________________________________________
>> Architecture mailing list
>> Architecture@wso2.org
>> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>>
>>
>
>
> --
>
> *Prabath Ariyarathna*
>
> *Associate Technical Lead*
>
> *WSO2, Inc. *
>
> *lean . enterprise . middleware *
>
>
> *Email: prabat...@wso2.com <prabat...@wso2.com>*
>
> *Blog: http://prabu-lk.blogspot.com <http://prabu-lk.blogspot.com>*
>
> *Flicker : https://www.flickr.com/photos/47759189@N08
> <https://www.flickr.com/photos/47759189@N08>*
>
> *Mobile: +94 77 699 4730 *
>
>
>
>
>
>
> _______________________________________________
> Architecture mailing list
> Architecture@wso2.org
> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>
>
_______________________________________________
Architecture mailing list
Architecture@wso2.org
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to