ofbiz-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Foxworthy (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (OFBIZ-7073) Add WebSocket support in OFBiz
Date Wed, 23 Nov 2016 04:39:58 GMT

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

Paul Foxworthy edited comment on OFBIZ-7073 at 11/23/16 4:39 AM:
-----------------------------------------------------------------

I'm really uncomfortable with adding metadata to the name of a jar. If there are three other
characteristics we want to selectively enable, would we have jars named
{noformat}
 <component>-discoverable-<thing2>-<thing3>.jar
{noformat}? 

Do I need to customise the standard Gradle build file to enable WebSockets?

Since we're overriding the check method and we can put whatever code we like there, could
we read a setting out a properties file instead of embedding it in the name of the jar?


was (Author: paul_foxworthy):
I'm really uncomfortable with adding metadata to the name of a jar. If there are three other
characteristics we want to selectively enable, would we have jars named <component>-discoverable-<thing2>-<thing3>.jar?
Do I need to customise the standard Gradle build file to enable WebSockets?

Since we're overriding the check method and we can put whatever code we like there, could
we read a setting out a properties file instead of embedding it in the name of the jar?

> Add WebSocket support in OFBiz
> ------------------------------
>
>                 Key: OFBIZ-7073
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-7073
>             Project: OFBiz
>          Issue Type: New Feature
>          Components: framework
>    Affects Versions: Trunk
>            Reporter: Amardeep Singh Jhajj
>            Assignee: Jacques Le Roux
>             Fix For: Upcoming Branch
>
>         Attachments: OFBIZ-7073.patch, OFBIZ-7073.patch, tomcat-embed-websocket-8.0.33.jar
>
>
> I tried to use websockets in OFBiz. I simply added tomcat-embed-websocket.jar in catalina
lib and created one webapp for websocket and also added server endpoint class.
> It didn't work. After that, I tried the same thing with plain j2ee application with embedded
tomcat. It worked there.
> I researched on above issue in OFBiz and got the reason. Websockets implementation need
jar scanning enabled and it is currently disabled in OFBiz. Below is the code snippet of disabling
jar scan from CatalinaContainer.java:
> {code}
> JarScanner jarScanner = context.getJarScanner();
> if (jarScanner instanceof StandardJarScanner) {
>     StandardJarScanner standardJarScanner = (StandardJarScanner) jarScanner;
>     standardJarScanner.setScanClassPath(false);
> }
> {code}
> Jar scanning enabling increase OFBiz server startup time upto couples of minutes (in
my case, it took approx 8 minutes), so we don't want this much of startup time for OFBiz.
>  
> I got the following document where I found the reason why websocket is not working if
scanning disabled.
> https://wiki.apache.org/tomcat/HowTo/FasterStartUp
> Here tips are given to decrease the startup time. This tips also include disabling of
jar scanning. 
> We can say disabling jar scanning is right approach because if we enable it then scanner
will scan all the jars loaded in OFBiz startup that we don't want.
> But, If we want websockets working then we have to enable jar scanning.
> For enabling jar scanning, we need below code:
> {code}
> standardJarScanner.setScanClassPath(true); // Will increase server startup time.
> {code}
> Solution: We can add filter on jar scanning. It will allow only some kind of jars only.
For example: jars having websockets endpoints. I am attaching patch for the same here.
> I added filter like if jar name string contains "discoverable" word then only it will
be considered for jar scan. We can change jar name of our jars using build.xml to make it
discoverable for jar scanning.
> For example: I have added my websocket endpoint class in "specialpurpose/ecommerce/src"
and changed the "name" property in build.xml of ecommerce component from "ofbiz-ecommerce"
> to "ofbiz-ecommerce-discoverable". Here is the code snippet from build.xml:
> {code}
> <property name="name" value="ofbiz-ecommerce-discoverable"/>
> {code}
> This change will create the jar with name "ofbiz-ecommerce-discoverable.jar" in "ecommerce/build/lib/".
> Now created jar will be scanned in jar scanner as its name contains "discoverable" word
in it.
> This change will not increase server start up time more than couple of seconds (in my
case, it just two seconds). So scanning time totally depends on the list of jars scanned.
> Conclusion: We can use websocket support with the help of jar filters.
> I am also attaching the version 8.0.33 tomcat-embed-websocket.jar.



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

Mime
View raw message