Hi Tharindu, Correct. As we discussed, we are making two network calls for the same functionality. Assuming that the network call is costly, when number of log-in users increasing and fetching Human Tasks available on BPS server, network traffic is increased.
However, It might not affect very badly when there are less number of concurrent log-ins. On the other-hand, it might be the case for highly occupied production environment. Thank you On Fri, Mar 20, 2015 at 11:48 PM, Tharindu Dharmarathna <tharin...@wso2.com> wrote: > Hi Rasika, > > Thank you for the clarification , and as our offline chat we are sending > multiple network calls to the BPS is that not become issue come into the > production ? . > > Thanks and Regards > Tharindu. > > On Fri, Mar 20, 2015 at 11:37 PM, Rasika Perera <rasi...@wso2.com> wrote: > >> Hi Lakmali, >> >> +1 for the explanation. In your solution, I think HTTP HEAD[1] is better >> to testing accessibility of the server endpoint. >> >> var httpClient = new >> Packages.org.apache.http.impl.client.DefaultHttpClient(); >> var *httpHead* = new Packages.org.apache.http.client.methods.*HttpHead* >> (endpoint); >> var response = httpClient.execute(*httpHead*); >> BPSRunning = true; >> >> [1] >> http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/client/methods/HttpHead.html >> >> Thank you >> >> On Fri, Mar 20, 2015 at 11:53 AM, Lakmali Baminiwatta <lakm...@wso2.com> >> wrote: >> >>> Thanks Ruchira for the information. >>> >>> On 19 March 2015 at 18:00, Ruchira Wageesha <ruch...@wso2.com> wrote: >>> >>>> Following are the possible options that I can think. >>>> >>>> 1. Patching XHR to get rid of the log message >>>> 2. Hiding the error from log4j, but AFAIK, then it will not log any >>>> error from XHR >>>> 3. Using any Java's http-client directly from Jaggery[a] to do the HTTP >>>> calls instead of XHR >>>> 4. Using any Java's http-client to check the endpoint status, and >>>> continue original HTTP call with XHR >>>> >>>> [a] >>>> https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Rhino/Scripting_Java >>>> >>>> /Ruchira >>>> >>>> On Thu, Mar 19, 2015 at 5:18 PM, Lakmali Baminiwatta <lakm...@wso2.com> >>>> wrote: >>>> >>>>> Hi Ruchira, >>>>> >>>>> In APIM and APPM we talk to the BPS server and fetch Human Tasks >>>>> available. For that when the user is login to the admin-dashboard jaggery >>>>> app, we do a login call to BPS server using XMLHttpRequest. At this point, >>>>> if the BPS is not running we are getting this connection refused error in >>>>> the logs. We need to handle this. >>>>> >>>>> As Tharindu mentioned, XMLHttpRequestHostObject.java uses >>>>> log.error(e.getMessage(), >>>>> e); [1]. Therefore we can't get rid of this stack trace in the log by >>>>> just catching the exception. >>>>> >>>>> Is there any method in jaggery that we can use to check whether server >>>>> is up and running before doing the send call and handle this? Appreciate >>>>> any help on this. >>>>> >>>>> [1] >>>>> https://github.com/wso2/jaggery/blob/0.9.0.ALPHA4.wso2v4/components/hostobjects/org.jaggeryjs.hostobjects.xhr/src/main/java/org/jaggeryjs/hostobjects/xhr/XMLHttpRequestHostObject.java >>>>> [2]https://wso2.org/jira/browse/APPM-587 >>>>> [3]https://wso2.org/jira/browse/APIMANAGER-3139 >>>>> >>>>> Thanks, >>>>> Lakmali >>>>> >>>>> On 18 March 2015 at 08:57, Tharindu Dharmarathna <tharin...@wso2.com> >>>>> wrote: >>>>> >>>>>> Hi Ruchira, >>>>>> >>>>>> We want to carch the exception according to connection refused >>>>>> exception from the jaggery side . Due to logging of this exception from >>>>>> Hostobject We couldn't remove this exception come from the console. >>>>>> >>>>>> Is there any way of check a server is up and running from jaggery >>>>>> side . If there's a way we can avoid exception come from the console. >>>>>> >>>>>> Thanks >>>>>> Tharindu >>>>>> >>>>>> On Wed, Mar 18, 2015 at 2:06 AM, Ruchira Wageesha <ruch...@wso2.com> >>>>>> wrote: >>>>>> >>>>>>> What is the issue with going try/catch blocks? >>>>>>> >>>>>>> /Ruchira >>>>>>> >>>>>>> On Tue, Mar 17, 2015 at 5:56 PM, Tharindu Dharmarathna < >>>>>>> tharin...@wso2.com> wrote: >>>>>>> >>>>>>>> Hi all, >>>>>>>> >>>>>>>> According to public jira [1] how can we handle connection refused >>>>>>>> exception come from this issue . This come from the send method. >>>>>>>> >>>>>>>> code snippest for this issue >>>>>>>> >>>>>>>>> >>>>>>>>> try{ >>>>>>>>> var xhr = new XMLHttpRequest(); >>>>>>>>> var site = require("/site/conf/site.json"); >>>>>>>>> var endpoint = >>>>>>>>> site.workflows.applicationWorkFlowServerURL+"AuthenticationAdmin"; >>>>>>>>> xhr.open("POST", endpoint); >>>>>>>>> var payload = '<soap:Envelope xmlns:soap=" >>>>>>>>> http://www.w3.org/2003/05/soap-envelope" xmlns:aut=" >>>>>>>>> http://authentication.services.core.carbon.wso2.org"><soap:Header/><soap:Body><aut:login><aut:username>' >>>>>>>>> + username + '</aut:username><aut:password>' + password + >>>>>>>>> '</aut:password><aut:remoteAddress>localhost</aut:remoteAddress></aut:login></soap:Body></soap:Envelope>'; >>>>>>>>> xhr.send(payload); >>>>>>>>> var cookie = (xhr.getAllResponseHeaders()); >>>>>>>>> log.info(xhr.readyState); >>>>>>>>> //session.put("workflowCookie",cookie.split(";")[0].split(":")[1]); >>>>>>>>> var sessionCookie = xhr.getResponseHeader("Set-Cookie"); >>>>>>>>> session.put("workflowCookie",sessionCookie); >>>>>>>>> }catch (e) { >>>>>>>>> // log.error(e.message); >>>>>>>>> } >>>>>>>> >>>>>>>> >>>>>>>> Exception come from the following jaggery hostobject code >>>>>>>> >>>>>>>> private static void executeRequest(Context cx, >>>>>>>>> XMLHttpRequestHostObject xhr) throws ScriptException { >>>>>>>>> try { >>>>>>>>> xhr.httpClient.executeMethod(xhr.method); >>>>>>>>> xhr.statusLine = xhr.method.getStatusLine(); >>>>>>>>> xhr.responseHeaders = xhr.method.getResponseHeaders(); >>>>>>>>> updateReadyState(cx, xhr, HEADERS_RECEIVED); >>>>>>>>> byte[] response = xhr.method.getResponseBody(); >>>>>>>>> if (response.length > 0) { >>>>>>>>> xhr.responseText = new String(response); >>>>>>>>> } >>>>>>>>> Header contentType = xhr.method.getResponseHeader("Content-Type"); >>>>>>>>> if (contentType != null) { >>>>>>>>> xhr.responseType = contentType.getValue(); >>>>>>>>> } >>>>>>>>> updateReadyState(cx, xhr, DONE); >>>>>>>>> } catch (IOException e) { >>>>>>>>> log.error(e.getMessage(), e); >>>>>>>>> throw new ScriptException(e); >>>>>>>>> } finally { >>>>>>>>> xhr.method.releaseConnection(); >>>>>>>>> } >>>>>>>>> } >>>>>>>> >>>>>>>> XMLHttpRequestHostObject.java >>>>>>>> >>>>>>>> [1] - https://wso2.org/jira/browse/APIMANAGER-3139 >>>>>>>> >>>>>>>> Thanks and regards >>>>>>>> >>>>>>>> >>>>>>>> *Tharindu Dharmarathna*Associate Software Engineer >>>>>>>> WSO2 Inc.; http://wso2.com >>>>>>>> lean.enterprise.middleware >>>>>>>> >>>>>>>> mobile: *+94779109091 <%2B94779109091>* >>>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> >>>>>>> *Ruchira Wageesha**Associate Technical Lead* >>>>>>> *WSO2 Inc. - lean . enterprise . middleware | wso2.com >>>>>>> <http://wso2.com>* >>>>>>> >>>>>>> *email: ruch...@wso2.com <ruch...@wso2.com>, blog: >>>>>>> ruchirawageesha.blogspot.com <http://ruchirawageesha.blogspot.com>, >>>>>>> mobile: +94 77 5493444 <%2B94%2077%205493444>* >>>>>>> >>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> >>>>>> *Tharindu Dharmarathna*Associate Software Engineer >>>>>> WSO2 Inc.; http://wso2.com >>>>>> lean.enterprise.middleware >>>>>> >>>>>> mobile: *+94779109091 <%2B94779109091>* >>>>>> >>>>>> _______________________________________________ >>>>>> Dev mailing list >>>>>> Dev@wso2.org >>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>>>>> >>>>>> >>>>> >>>>> >>>>> -- >>>>> Lakmali Baminiwatta >>>>> Senior Software Engineer >>>>> WSO2, Inc.: http://wso2.com >>>>> lean.enterprise.middleware >>>>> mobile: +94 71 2335936 >>>>> blog : lakmali.com >>>>> >>>>> >>>> >>>> >>>> -- >>>> >>>> *Ruchira Wageesha**Associate Technical Lead* >>>> *WSO2 Inc. - lean . enterprise . middleware | wso2.com >>>> <http://wso2.com>* >>>> >>>> *email: ruch...@wso2.com <ruch...@wso2.com>, blog: >>>> ruchirawageesha.blogspot.com <http://ruchirawageesha.blogspot.com>, >>>> mobile: +94 77 5493444 <%2B94%2077%205493444>* >>>> >>> >>> >>> >>> -- >>> Lakmali Baminiwatta >>> Senior Software Engineer >>> WSO2, Inc.: http://wso2.com >>> lean.enterprise.middleware >>> mobile: +94 71 2335936 >>> blog : lakmali.com >>> >>> >>> _______________________________________________ >>> Dev mailing list >>> Dev@wso2.org >>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>> >>> >> >> >> -- >> With Regards, >> >> *Rasika Perera* >> Software Engineer >> M: +94 71 680 9060 E: rasi...@wso2.com >> LinkedIn: http://lk.linkedin.com/in/rasika90 >> >> WSO2 Inc. www.wso2.com >> lean.enterprise.middleware >> >> _______________________________________________ >> Dev mailing list >> Dev@wso2.org >> http://wso2.org/cgi-bin/mailman/listinfo/dev >> >> > > > -- > > *Tharindu Dharmarathna*Associate Software Engineer > WSO2 Inc.; http://wso2.com > lean.enterprise.middleware > > mobile: *+94779109091 <%2B94779109091>* > -- With Regards, *Rasika Perera* Software Engineer M: +94 71 680 9060 E: rasi...@wso2.com LinkedIn: http://lk.linkedin.com/in/rasika90 WSO2 Inc. www.wso2.com lean.enterprise.middleware
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev