You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Rajesh Mallah <ma...@gmail.com> on 2018/08/07 05:38:56 UTC

Re: tenant handling in XMLRPC

Hi ,

I was giving this problem another shot but need help.


The original problem is that , it is not possible to direct
XML / RPC requests  to specific tenants in a multi-tenant
environment. This problem is significant as it forces us to have
multiple instances of ofbiz running which are not utilized to fullest
extent.


The exact problem i am facing is that i need to get 'HttpServletRequest'
object inside the handler that implements XmlRpcHandler. This is to
create "local" copies of dispatcher and delegator on per - request basis
as Scott suggested not to use the class level variables of the singleton
due to concurrency concerns.

pls refer:
framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/XmlRpcEventHandler.java

if we are able to get HttpServletRequest inside the handler
we could get the delegator and dispatcher as:

=====================
  dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
  delegator = (Delegator) request.getAttribute("delegator");

=====================

A JIRA for the same was already filed:

>> https://issues.apache.org/jira/browse/OFBIZ-10284

Someone else had also faced a similar situation here:

https://coderanch.com/t/415677/java/remote-IP-Address-JAX-RPC


Any suggestions is humbly solicited.

regds
mallah.

Re: tenant handling in XMLRPC

Posted by Rajesh Mallah <ma...@gmail.com>.
Thanks Taher.


regds
mallah.

On Thu, Aug 9, 2018 at 3:30 PM, Taher Alkhateeb <sl...@gmail.com>
wrote:

> Hi Rajesh,
>
> We usually implement our work using JIRA [1]. So I recommend you apply
> your patch against the latest version of trunk over there and then ask
> for it to be committed.
>
> [1] https://issues.apache.org/jira/browse/OFBIZ
>
> On Tue, Aug 7, 2018 at 10:06 PM, Rajesh Mallah <ma...@gmail.com>
> wrote:
> >
> > Hello  Everyone / Mr Scott ,
> >
> > I have been able to churn out a patch finally.
> >
> > The request level dispatcher is being stored in a member variable of
> > a class derived from  XmlRpcHttpRequestConfigImpl .
> >
> > in the execute method of ServiceRpcHandler the dispatcher is being
> > extracted from the config.
> >
> > This has been tested in a simulated concurrent scenario that was
> > previously failing to provide correct results unless dispatcher was
> > localized at request level.
> >
> > Kindly have a look at the attached patch.
> >
> > regds
> > mallah
> >
> >
> > On Tue, Aug 7, 2018 at 11:08 AM, Rajesh Mallah <ma...@gmail.com>
> > wrote:
> >>
> >>
> >> Hi ,
> >>
> >> I was giving this problem another shot but need help.
> >>
> >>
> >> The original problem is that , it is not possible to direct
> >> XML / RPC requests  to specific tenants in a multi-tenant
> >> environment. This problem is significant as it forces us to have
> >> multiple instances of ofbiz running which are not utilized to fullest
> >> extent.
> >>
> >>
> >> The exact problem i am facing is that i need to get 'HttpServletRequest'
> >> object inside the handler that implements XmlRpcHandler. This is to
> >> create "local" copies of dispatcher and delegator on per - request basis
> >> as Scott suggested not to use the class level variables of the singleton
> >> due to concurrency concerns.
> >>
> >> pls refer:
> >> framework/webapp/src/main/java/org/apache/ofbiz/webapp/
> event/XmlRpcEventHandler.java
> >>
> >> if we are able to get HttpServletRequest inside the handler
> >> we could get the delegator and dispatcher as:
> >>
> >> =====================
> >>   dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
> >>   delegator = (Delegator) request.getAttribute("delegator");
> >>
> >> =====================
> >>
> >> A JIRA for the same was already filed:
> >>
> >> >> https://issues.apache.org/jira/browse/OFBIZ-10284
> >>
> >> Someone else had also faced a similar situation here:
> >>
> >> https://coderanch.com/t/415677/java/remote-IP-Address-JAX-RPC
> >>
> >>
> >> Any suggestions is humbly solicited.
> >>
> >> regds
> >> mallah.
> >>
> >>
> >>
> >>
> >>
> >
>

Re: tenant handling in XMLRPC

Posted by Taher Alkhateeb <sl...@gmail.com>.
Hi Rajesh,

We usually implement our work using JIRA [1]. So I recommend you apply
your patch against the latest version of trunk over there and then ask
for it to be committed.

[1] https://issues.apache.org/jira/browse/OFBIZ

On Tue, Aug 7, 2018 at 10:06 PM, Rajesh Mallah <ma...@gmail.com> wrote:
>
> Hello  Everyone / Mr Scott ,
>
> I have been able to churn out a patch finally.
>
> The request level dispatcher is being stored in a member variable of
> a class derived from  XmlRpcHttpRequestConfigImpl .
>
> in the execute method of ServiceRpcHandler the dispatcher is being
> extracted from the config.
>
> This has been tested in a simulated concurrent scenario that was
> previously failing to provide correct results unless dispatcher was
> localized at request level.
>
> Kindly have a look at the attached patch.
>
> regds
> mallah
>
>
> On Tue, Aug 7, 2018 at 11:08 AM, Rajesh Mallah <ma...@gmail.com>
> wrote:
>>
>>
>> Hi ,
>>
>> I was giving this problem another shot but need help.
>>
>>
>> The original problem is that , it is not possible to direct
>> XML / RPC requests  to specific tenants in a multi-tenant
>> environment. This problem is significant as it forces us to have
>> multiple instances of ofbiz running which are not utilized to fullest
>> extent.
>>
>>
>> The exact problem i am facing is that i need to get 'HttpServletRequest'
>> object inside the handler that implements XmlRpcHandler. This is to
>> create "local" copies of dispatcher and delegator on per - request basis
>> as Scott suggested not to use the class level variables of the singleton
>> due to concurrency concerns.
>>
>> pls refer:
>> framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/XmlRpcEventHandler.java
>>
>> if we are able to get HttpServletRequest inside the handler
>> we could get the delegator and dispatcher as:
>>
>> =====================
>>   dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
>>   delegator = (Delegator) request.getAttribute("delegator");
>>
>> =====================
>>
>> A JIRA for the same was already filed:
>>
>> >> https://issues.apache.org/jira/browse/OFBIZ-10284
>>
>> Someone else had also faced a similar situation here:
>>
>> https://coderanch.com/t/415677/java/remote-IP-Address-JAX-RPC
>>
>>
>> Any suggestions is humbly solicited.
>>
>> regds
>> mallah.
>>
>>
>>
>>
>>
>

Re: tenant handling in XMLRPC

Posted by Rajesh Mallah <ma...@gmail.com>.
Hello  Everyone / Mr Scott ,

I have been able to churn out a patch finally.

The request level dispatcher is being stored in a member variable of
a class derived from  XmlRpcHttpRequestConfigImpl .

in the execute method of ServiceRpcHandler the dispatcher is being
extracted from the config.

This has been tested in a simulated concurrent scenario that was
previously failing to provide correct results unless dispatcher was
localized at request level.

Kindly have a look at the attached patch.

regds
mallah


On Tue, Aug 7, 2018 at 11:08 AM, Rajesh Mallah <ma...@gmail.com>
wrote:

>
> Hi ,
>
> I was giving this problem another shot but need help.
>
>
> The original problem is that , it is not possible to direct
> XML / RPC requests  to specific tenants in a multi-tenant
> environment. This problem is significant as it forces us to have
> multiple instances of ofbiz running which are not utilized to fullest
> extent.
>
>
> The exact problem i am facing is that i need to get 'HttpServletRequest'
> object inside the handler that implements XmlRpcHandler. This is to
> create "local" copies of dispatcher and delegator on per - request basis
> as Scott suggested not to use the class level variables of the singleton
> due to concurrency concerns.
>
> pls refer:   framework/webapp/src/main/java/org/apache/ofbiz/webapp/
> event/XmlRpcEventHandler.java
>
> if we are able to get HttpServletRequest inside the handler
> we could get the delegator and dispatcher as:
>
> =====================
>   dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
>   delegator = (Delegator) request.getAttribute("delegator");
>
> =====================
>
> A JIRA for the same was already filed:
>
> >> https://issues.apache.org/jira/browse/OFBIZ-10284
>
> Someone else had also faced a similar situation here:
>
> https://coderanch.com/t/415677/java/remote-IP-Address-JAX-RPC
>
>
> Any suggestions is humbly solicited.
>
> regds
> mallah.
>
>
>
>
>
>