Ofbiz Concurrency handling

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|

Ofbiz Concurrency handling

Michał Cukierman
Hello,

I do ofbiz customization with some code changes. At the moment Im
extending ecommerce catalog and product structure. This action requires
additional services to be implemented.

So, I am wondering how ofbiz implements concurent programing issues.
In FTL files in most cases it invokes
public, static, NOT synchronized methods.

Just an example:
http://www.java2s.com/Open-Source/Java-Document/ERP-CRM-Financial/SourceTap-CRM/org/ofbiz/product/category/CategoryWorker.java.htm

Are we sure that while invoking:
i.e. getRelatedCategories
We get our related categories?

See:
http://tutorials.jenkov.com/java-concurrency/synchronized.html
for concurrency basics.

Regards,
Michał

Reply | Threaded
Open this post in threaded view
|

Re: Ofbiz Concurrency handling

Michał Cukierman
Can anyone help me with understandin Ofbiz concurrency handling?
Is it thread safe?

Dnia 2010-09-02, czw o godzinie 15:23 +0200, Michał Cukierman pisze:

> Hello,
>
> I do ofbiz customization with some code changes. At the moment Im
> extending ecommerce catalog and product structure. This action requires
> additional services to be implemented.
>
> So, I am wondering how ofbiz implements concurent programing issues.
> In FTL files in most cases it invokes
> public, static, NOT synchronized methods.
>
> Just an example:
> http://www.java2s.com/Open-Source/Java-Document/ERP-CRM-Financial/SourceTap-CRM/org/ofbiz/product/category/CategoryWorker.java.htm
>
> Are we sure that while invoking:
> i.e. getRelatedCategories
> We get our related categories?
>
> See:
> http://tutorials.jenkov.com/java-concurrency/synchronized.html
> for concurrency basics.
>
> Regards,
> Michał
>

Reply | Threaded
Open this post in threaded view
|

Re: Ofbiz Concurrency handling

Adrian Crum-2
What exactly do you need to know? Are you running into any concurrency issues?

-Adrian

--- On Fri, 9/3/10, Michał Cukierman <[hidden email]> wrote:

> From: Michał Cukierman <[hidden email]>
> Subject: Re: Ofbiz Concurrency handling
> To: [hidden email]
> Date: Friday, September 3, 2010, 12:55 AM
> Can anyone help me with understandin
> Ofbiz concurrency handling?
> Is it thread safe?
>
> Dnia 2010-09-02, czw o godzinie 15:23 +0200, Michał
> Cukierman pisze:
> > Hello,
> >
> > I do ofbiz customization with some code changes. At
> the moment Im
> > extending ecommerce catalog and product structure.
> This action requires
> > additional services to be implemented.
> >
> > So, I am wondering how ofbiz implements concurent
> programing issues.
> > In FTL files in most cases it invokes
> > public, static, NOT synchronized methods.
> >
> > Just an example:
> > http://www.java2s.com/Open-Source/Java-Document/ERP-CRM-Financial/SourceTap-CRM/org/ofbiz/product/category/CategoryWorker.java.htm
> >
> > Are we sure that while invoking:
> > i.e. getRelatedCategories
> > We get our related categories?
> >
> > See:
> > http://tutorials.jenkov.com/java-concurrency/synchronized.html
> > for concurrency basics.
> >
> > Regards,
> > Michał
> >
>
>



Reply | Threaded
Open this post in threaded view
|

Re: Ofbiz Concurrency handling

Michał Cukierman
Hi,

I am developing custom services and I want to know if invocation of
public static methods are handled for example in some introspectors or
in FTL controllers. If no - I am gonna to handle it by my own. But in
fact I belive I have missed something.

So my question is:
Is the Ofbiz thread safe?

I do not face issues when working on one machine but in the future I
excpect more visitors than one.

If (If) those methods are not handled in any places, why don't you use
synchronized keyword?

Regards,
Michał Cukierman


Dnia 2010-09-03, pią o godzinie 05:55 -0700, Adrian Crum pisze:

> What exactly do you need to know? Are you running into any concurrency issues?
>
> -Adrian
>
> --- On Fri, 9/3/10, Michał Cukierman <[hidden email]> wrote:
>
> > From: Michał Cukierman <[hidden email]>
> > Subject: Re: Ofbiz Concurrency handling
> > To: [hidden email]
> > Date: Friday, September 3, 2010, 12:55 AM
> > Can anyone help me with understandin
> > Ofbiz concurrency handling?
> > Is it thread safe?
> >
> > Dnia 2010-09-02, czw o godzinie 15:23 +0200, Michał
> > Cukierman pisze:
> > > Hello,
> > >
> > > I do ofbiz customization with some code changes. At
> > the moment Im
> > > extending ecommerce catalog and product structure.
> > This action requires
> > > additional services to be implemented.
> > >
> > > So, I am wondering how ofbiz implements concurent
> > programing issues.
> > > In FTL files in most cases it invokes
> > > public, static, NOT synchronized methods.
> > >
> > > Just an example:
> > > http://www.java2s.com/Open-Source/Java-Document/ERP-CRM-Financial/SourceTap-CRM/org/ofbiz/product/category/CategoryWorker.java.htm
> > >
> > > Are we sure that while invoking:
> > > i.e. getRelatedCategories
> > > We get our related categories?
> > >
> > > See:
> > > http://tutorials.jenkov.com/java-concurrency/synchronized.html
> > > for concurrency basics.
> > >
> > > Regards,
> > > Michał
> > >
> >
> >
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Ofbiz Concurrency handling

Adrian Crum
As long as you use the tools OFBiz provides, you do not need to worry
about concurrency in Java code. OFbiz is a suite of multi-threaded
applications that serve thousands of simultaneous users.

A common mistake new users make is to go directly to Java code and they
end up getting mired in details like this. You don't need to do that. If
you stick with the higher level tools you will be more productive and
have a lot less to worry about.

-Adrian

On 9/3/2010 6:28 AM, Michał Cukierman wrote:

> Hi,
>
> I am developing custom services and I want to know if invocation of
> public static methods are handled for example in some introspectors or
> in FTL controllers. If no - I am gonna to handle it by my own. But in
> fact I belive I have missed something.
>
> So my question is:
> Is the Ofbiz thread safe?
>
> I do not face issues when working on one machine but in the future I
> excpect more visitors than one.
>
> If (If) those methods are not handled in any places, why don't you use
> synchronized keyword?
>
> Regards,
> Michał Cukierman
>
>
> Dnia 2010-09-03, pią o godzinie 05:55 -0700, Adrian Crum pisze:
>> What exactly do you need to know? Are you running into any concurrency issues?
>>
>> -Adrian
>>
>> --- On Fri, 9/3/10, Michał Cukierman<[hidden email]>  wrote:
>>
>>> From: Michał Cukierman<[hidden email]>
>>> Subject: Re: Ofbiz Concurrency handling
>>> To: [hidden email]
>>> Date: Friday, September 3, 2010, 12:55 AM
>>> Can anyone help me with understandin
>>> Ofbiz concurrency handling?
>>> Is it thread safe?
>>>
>>> Dnia 2010-09-02, czw o godzinie 15:23 +0200, Michał
>>> Cukierman pisze:
>>>> Hello,
>>>>
>>>> I do ofbiz customization with some code changes. At
>>> the moment Im
>>>> extending ecommerce catalog and product structure.
>>> This action requires
>>>> additional services to be implemented.
>>>>
>>>> So, I am wondering how ofbiz implements concurent
>>> programing issues.
>>>> In FTL files in most cases it invokes
>>>> public, static, NOT synchronized methods.
>>>>
>>>> Just an example:
>>>> http://www.java2s.com/Open-Source/Java-Document/ERP-CRM-Financial/SourceTap-CRM/org/ofbiz/product/category/CategoryWorker.java.htm
>>>>
>>>> Are we sure that while invoking:
>>>> i.e. getRelatedCategories
>>>> We get our related categories?
>>>>
>>>> See:
>>>> http://tutorials.jenkov.com/java-concurrency/synchronized.html
>>>> for concurrency basics.
>>>>
>>>> Regards,
>>>> Michał
>>>>
>>>
>>>
>>
>>
>>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Ofbiz Concurrency handling

Michał Cukierman
 
> You don't need to do that. If
> you stick with the higher level tools you will be more productive and
> have a lot less to worry about.

Are you sure about that?
Or you just havn't  had problems with concurrency issues?

You can't just use application/framework without knowing whats inside.
For the last year I worked for Aerospace and Defence company, and in
such cases code quality is critical.

It's just a matter of time/load/data sets sizes, or just a bad luck,
when such a code will be a problem.

I am not fan of "Luck driven development", so I want to clarify my
concerns in here. But talking like:
"Don't worry, it will work"
Is not a good argument.

As far as Ofbiz is a small application, it should not be a problem to
fix such issues. just find all static public methods invoked from
multiple threads and make them synchronized.



 


Dnia 2010-09-03, pią o godzinie 07:16 -0700, Adrian Crum pisze:

> As long as you use the tools OFBiz provides, you do not need to worry
> about concurrency in Java code. OFbiz is a suite of multi-threaded
> applications that serve thousands of simultaneous users.
>
> A common mistake new users make is to go directly to Java code and they
> end up getting mired in details like this. You don't need to do that. If
> you stick with the higher level tools you will be more productive and
> have a lot less to worry about.
>
> -Adrian
>
> On 9/3/2010 6:28 AM, Michał Cukierman wrote:
> > Hi,
> >
> > I am developing custom services and I want to know if invocation of
> > public static methods are handled for example in some introspectors or
> > in FTL controllers. If no - I am gonna to handle it by my own. But in
> > fact I belive I have missed something.
> >
> > So my question is:
> > Is the Ofbiz thread safe?
> >
> > I do not face issues when working on one machine but in the future I
> > excpect more visitors than one.
> >
> > If (If) those methods are not handled in any places, why don't you use
> > synchronized keyword?
> >
> > Regards,
> > Michał Cukierman
> >
> >
> > Dnia 2010-09-03, pią o godzinie 05:55 -0700, Adrian Crum pisze:
> >> What exactly do you need to know? Are you running into any concurrency issues?
> >>
> >> -Adrian
> >>
> >> --- On Fri, 9/3/10, Michał Cukierman<[hidden email]>  wrote:
> >>
> >>> From: Michał Cukierman<[hidden email]>
> >>> Subject: Re: Ofbiz Concurrency handling
> >>> To: [hidden email]
> >>> Date: Friday, September 3, 2010, 12:55 AM
> >>> Can anyone help me with understandin
> >>> Ofbiz concurrency handling?
> >>> Is it thread safe?
> >>>
> >>> Dnia 2010-09-02, czw o godzinie 15:23 +0200, Michał
> >>> Cukierman pisze:
> >>>> Hello,
> >>>>
> >>>> I do ofbiz customization with some code changes. At
> >>> the moment Im
> >>>> extending ecommerce catalog and product structure.
> >>> This action requires
> >>>> additional services to be implemented.
> >>>>
> >>>> So, I am wondering how ofbiz implements concurent
> >>> programing issues.
> >>>> In FTL files in most cases it invokes
> >>>> public, static, NOT synchronized methods.
> >>>>
> >>>> Just an example:
> >>>> http://www.java2s.com/Open-Source/Java-Document/ERP-CRM-Financial/SourceTap-CRM/org/ofbiz/product/category/CategoryWorker.java.htm
> >>>>
> >>>> Are we sure that while invoking:
> >>>> i.e. getRelatedCategories
> >>>> We get our related categories?
> >>>>
> >>>> See:
> >>>> http://tutorials.jenkov.com/java-concurrency/synchronized.html
> >>>> for concurrency basics.
> >>>>
> >>>> Regards,
> >>>> Michał
> >>>>
> >>>
> >>>
> >>
> >>
> >>
> >
> >

Reply | Threaded
Open this post in threaded view
|

Re: Ofbiz Concurrency handling

David E. Jones-2

I think what Adrian means to say is that if you use the higher level tools in OFBiz such as the simple-methods instead of writing code in Java you're not as likely to run into concurrency issues.

More generally, OFBiz consists of a fairly large body of code and is created by a large number of contributors. For the most part code in the OFBiz Framework is widely used and pretty well tested, and when there are concurrency problems they generally get fixed (that's no guarantee, just a general trend). In addition to the possibility of concurrency problems in framework code, there is also a possibility of concurrency problems in business logic, especially business logic written in Java.

Most business logic in OFBiz runs through the Service Engine, which coordinates the calling of stateless services. Even services written in Java as static methods are fine as long as they don't refer to static variables, or as long as they do so in a way that is thread-safe (like objects written to handle concurrency).

The idea that all static methods need to be synchronized is totally unfounded. You can do so if you wish, but it will kill performance and most of the time do nothing to help with concurrency issues. In fact, it will cause concurrency problems of all sorts and make your system scale really poorly, to the point of causing frequent errors and failures with timeouts, deadlocks, and so on.

You're right about the testing aspect. If you are concerned about concurrency issues, the only thing to do is learn about concurrency in Java, and test specifically for concurrency (The Grinder is a pretty good open source tool kit for doing that, and of course there are many others). Please keep in mind though that your intended use may be very different from the intended uses of other users of OFBiz, so again if there are things you are concerned about with concurrency or anything else, you should test those things. If you want to increase the chances of something working a certain way in the future in OFBiz itself, you should contribute automated test cases to test those things. It's that simple, and there is no substitute.

Another benefit of doing that testing is you can try out things like you mentioned, ie making all static methods synchronized, and then see what happens!

-David


On Sep 3, 2010, at 12:20 PM, Michał Cukierman wrote:

>
>> You don't need to do that. If
>> you stick with the higher level tools you will be more productive and
>> have a lot less to worry about.
>
> Are you sure about that?
> Or you just havn't  had problems with concurrency issues?
>
> You can't just use application/framework without knowing whats inside.
> For the last year I worked for Aerospace and Defence company, and in
> such cases code quality is critical.
>
> It's just a matter of time/load/data sets sizes, or just a bad luck,
> when such a code will be a problem.
>
> I am not fan of "Luck driven development", so I want to clarify my
> concerns in here. But talking like:
> "Don't worry, it will work"
> Is not a good argument.
>
> As far as Ofbiz is a small application, it should not be a problem to
> fix such issues. just find all static public methods invoked from
> multiple threads and make them synchronized.
>
>
>
>
>
>
> Dnia 2010-09-03, pią o godzinie 07:16 -0700, Adrian Crum pisze:
>> As long as you use the tools OFBiz provides, you do not need to worry
>> about concurrency in Java code. OFbiz is a suite of multi-threaded
>> applications that serve thousands of simultaneous users.
>>
>> A common mistake new users make is to go directly to Java code and they
>> end up getting mired in details like this. You don't need to do that. If
>> you stick with the higher level tools you will be more productive and
>> have a lot less to worry about.
>>
>> -Adrian
>>
>> On 9/3/2010 6:28 AM, Michał Cukierman wrote:
>>> Hi,
>>>
>>> I am developing custom services and I want to know if invocation of
>>> public static methods are handled for example in some introspectors or
>>> in FTL controllers. If no - I am gonna to handle it by my own. But in
>>> fact I belive I have missed something.
>>>
>>> So my question is:
>>> Is the Ofbiz thread safe?
>>>
>>> I do not face issues when working on one machine but in the future I
>>> excpect more visitors than one.
>>>
>>> If (If) those methods are not handled in any places, why don't you use
>>> synchronized keyword?
>>>
>>> Regards,
>>> Michał Cukierman
>>>
>>>
>>> Dnia 2010-09-03, pią o godzinie 05:55 -0700, Adrian Crum pisze:
>>>> What exactly do you need to know? Are you running into any concurrency issues?
>>>>
>>>> -Adrian
>>>>
>>>> --- On Fri, 9/3/10, Michał Cukierman<[hidden email]>  wrote:
>>>>
>>>>> From: Michał Cukierman<[hidden email]>
>>>>> Subject: Re: Ofbiz Concurrency handling
>>>>> To: [hidden email]
>>>>> Date: Friday, September 3, 2010, 12:55 AM
>>>>> Can anyone help me with understandin
>>>>> Ofbiz concurrency handling?
>>>>> Is it thread safe?
>>>>>
>>>>> Dnia 2010-09-02, czw o godzinie 15:23 +0200, Michał
>>>>> Cukierman pisze:
>>>>>> Hello,
>>>>>>
>>>>>> I do ofbiz customization with some code changes. At
>>>>> the moment Im
>>>>>> extending ecommerce catalog and product structure.
>>>>> This action requires
>>>>>> additional services to be implemented.
>>>>>>
>>>>>> So, I am wondering how ofbiz implements concurent
>>>>> programing issues.
>>>>>> In FTL files in most cases it invokes
>>>>>> public, static, NOT synchronized methods.
>>>>>>
>>>>>> Just an example:
>>>>>> http://www.java2s.com/Open-Source/Java-Document/ERP-CRM-Financial/SourceTap-CRM/org/ofbiz/product/category/CategoryWorker.java.htm
>>>>>>
>>>>>> Are we sure that while invoking:
>>>>>> i.e. getRelatedCategories
>>>>>> We get our related categories?
>>>>>>
>>>>>> See:
>>>>>> http://tutorials.jenkov.com/java-concurrency/synchronized.html
>>>>>> for concurrency basics.
>>>>>>
>>>>>> Regards,
>>>>>> Michał
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Ofbiz Concurrency handling

Adrian Crum-2
Thanks David!

I apologize if it seemed like I was just waving off the concerns. I speak from experience when I warn against diving right into the Java code - that's what I did when I first came across OFBiz and I wasted a lot of time there.

Get to know the services and the entity engine first. Then if you run across concurrency issues, bring them to our attention and we will look into it.

-Adrian

--- On Fri, 9/3/10, David E Jones <[hidden email]> wrote:

> From: David E Jones <[hidden email]>
> Subject: Re: Ofbiz Concurrency handling
> To: [hidden email]
> Date: Friday, September 3, 2010, 11:38 AM
>
> I think what Adrian means to say is that if you use the
> higher level tools in OFBiz such as the simple-methods
> instead of writing code in Java you're not as likely to run
> into concurrency issues.
>
> More generally, OFBiz consists of a fairly large body of
> code and is created by a large number of contributors. For
> the most part code in the OFBiz Framework is widely used and
> pretty well tested, and when there are concurrency problems
> they generally get fixed (that's no guarantee, just a
> general trend). In addition to the possibility of
> concurrency problems in framework code, there is also a
> possibility of concurrency problems in business logic,
> especially business logic written in Java.
>
> Most business logic in OFBiz runs through the Service
> Engine, which coordinates the calling of stateless services.
> Even services written in Java as static methods are fine as
> long as they don't refer to static variables, or as long as
> they do so in a way that is thread-safe (like objects
> written to handle concurrency).
>
> The idea that all static methods need to be synchronized is
> totally unfounded. You can do so if you wish, but it will
> kill performance and most of the time do nothing to help
> with concurrency issues. In fact, it will cause concurrency
> problems of all sorts and make your system scale really
> poorly, to the point of causing frequent errors and failures
> with timeouts, deadlocks, and so on.
>
> You're right about the testing aspect. If you are concerned
> about concurrency issues, the only thing to do is learn
> about concurrency in Java, and test specifically for
> concurrency (The Grinder is a pretty good open source tool
> kit for doing that, and of course there are many others).
> Please keep in mind though that your intended use may be
> very different from the intended uses of other users of
> OFBiz, so again if there are things you are concerned about
> with concurrency or anything else, you should test those
> things. If you want to increase the chances of something
> working a certain way in the future in OFBiz itself, you
> should contribute automated test cases to test those things.
> It's that simple, and there is no substitute.
>
> Another benefit of doing that testing is you can try out
> things like you mentioned, ie making all static methods
> synchronized, and then see what happens!
>
> -David
>
>
> On Sep 3, 2010, at 12:20 PM, Michał Cukierman wrote:
>
> >
> >> You don't need to do that. If
> >> you stick with the higher level tools you will be
> more productive and
> >> have a lot less to worry about.
> >
> > Are you sure about that?
> > Or you just havn't  had problems with concurrency
> issues?
> >
> > You can't just use application/framework without
> knowing whats inside.
> > For the last year I worked for Aerospace and Defence
> company, and in
> > such cases code quality is critical.
> >
> > It's just a matter of time/load/data sets sizes, or
> just a bad luck,
> > when such a code will be a problem.
> >
> > I am not fan of "Luck driven development", so I want
> to clarify my
> > concerns in here. But talking like:
> > "Don't worry, it will work"
> > Is not a good argument.
> >
> > As far as Ofbiz is a small application, it should not
> be a problem to
> > fix such issues. just find all static public methods
> invoked from
> > multiple threads and make them synchronized.
> >
> >
> >
> >
> >
> >
> > Dnia 2010-09-03, pią o godzinie 07:16 -0700, Adrian
> Crum pisze:
> >> As long as you use the tools OFBiz provides, you
> do not need to worry
> >> about concurrency in Java code. OFbiz is a suite
> of multi-threaded
> >> applications that serve thousands of simultaneous
> users.
> >>
> >> A common mistake new users make is to go directly
> to Java code and they
> >> end up getting mired in details like this. You
> don't need to do that. If
> >> you stick with the higher level tools you will be
> more productive and
> >> have a lot less to worry about.
> >>
> >> -Adrian
> >>
> >> On 9/3/2010 6:28 AM, Michał Cukierman wrote:
> >>> Hi,
> >>>
> >>> I am developing custom services and I want to
> know if invocation of
> >>> public static methods are handled for example
> in some introspectors or
> >>> in FTL controllers. If no - I am gonna to
> handle it by my own. But in
> >>> fact I belive I have missed something.
> >>>
> >>> So my question is:
> >>> Is the Ofbiz thread safe?
> >>>
> >>> I do not face issues when working on one
> machine but in the future I
> >>> excpect more visitors than one.
> >>>
> >>> If (If) those methods are not handled in any
> places, why don't you use
> >>> synchronized keyword?
> >>>
> >>> Regards,
> >>> Michał Cukierman
> >>>
> >>>
> >>> Dnia 2010-09-03, pią o godzinie 05:55 -0700,
> Adrian Crum pisze:
> >>>> What exactly do you need to know? Are you
> running into any concurrency issues?
> >>>>
> >>>> -Adrian
> >>>>
> >>>> --- On Fri, 9/3/10, Michał
> Cukierman<[hidden email]
> wrote:
> >>>>
> >>>>> From: Michał Cukierman<[hidden email]>
> >>>>> Subject: Re: Ofbiz Concurrency
> handling
> >>>>> To: [hidden email]
> >>>>> Date: Friday, September 3, 2010, 12:55
> AM
> >>>>> Can anyone help me with understandin
> >>>>> Ofbiz concurrency handling?
> >>>>> Is it thread safe?
> >>>>>
> >>>>> Dnia 2010-09-02, czw o godzinie 15:23
> +0200, Michał
> >>>>> Cukierman pisze:
> >>>>>> Hello,
> >>>>>>
> >>>>>> I do ofbiz customization with some
> code changes. At
> >>>>> the moment Im
> >>>>>> extending ecommerce catalog and
> product structure.
> >>>>> This action requires
> >>>>>> additional services to be
> implemented.
> >>>>>>
> >>>>>> So, I am wondering how ofbiz
> implements concurent
> >>>>> programing issues.
> >>>>>> In FTL files in most cases it
> invokes
> >>>>>> public, static, NOT synchronized
> methods.
> >>>>>>
> >>>>>> Just an example:
> >>>>>> http://www.java2s.com/Open-Source/Java-Document/ERP-CRM-Financial/SourceTap-CRM/org/ofbiz/product/category/CategoryWorker.java.htm
> >>>>>>
> >>>>>> Are we sure that while invoking:
> >>>>>> i.e. getRelatedCategories
> >>>>>> We get our related categories?
> >>>>>>
> >>>>>> See:
> >>>>>> http://tutorials.jenkov.com/java-concurrency/synchronized.html
> >>>>>> for concurrency basics.
> >>>>>>
> >>>>>> Regards,
> >>>>>> Michał
> >>>>>>
> >>>>>
> >>>>>
> >>>>
> >>>>
> >>>>
> >>>
> >>>
> >
>
>



Reply | Threaded
Open this post in threaded view
|

Re: Ofbiz Concurrency handling

Michał Cukierman
In reply to this post by David E. Jones-2
Thank you David,

That is exactly what I needed. I havn't noticed that in fact, all static
methods uses its local variables. In general I was seeing those methods
as unsafe - that was my mistake. Anyway Thanks of you I know that to
keep the things right I need to follow your convention - what was my key
point.

Regardin uses of i.e. simple methods - in general I try to reuse OOTB
code, so in some cases I need to know what author of the class had in
mind.

Sorry for my curious nature, but if somthing is not clear for me - I
need to have explanation. Thats what I get from you.

At this step I also see my second mistake - so usage of synchronized
keywod. Now I see it was unfounded, like you said.

Regards,
Michał



Dnia 2010-09-03, pią o godzinie 12:38 -0600, David E Jones pisze:

> I think what Adrian means to say is that if you use the higher level tools in OFBiz such as the simple-methods instead of writing code in Java you're not as likely to run into concurrency issues.
>
> More generally, OFBiz consists of a fairly large body of code and is created by a large number of contributors. For the most part code in the OFBiz Framework is widely used and pretty well tested, and when there are concurrency problems they generally get fixed (that's no guarantee, just a general trend). In addition to the possibility of concurrency problems in framework code, there is also a possibility of concurrency problems in business logic, especially business logic written in Java.
>
> Most business logic in OFBiz runs through the Service Engine, which coordinates the calling of stateless services. Even services written in Java as static methods are fine as long as they don't refer to static variables, or as long as they do so in a way that is thread-safe (like objects written to handle concurrency).
>
> The idea that all static methods need to be synchronized is totally unfounded. You can do so if you wish, but it will kill performance and most of the time do nothing to help with concurrency issues. In fact, it will cause concurrency problems of all sorts and make your system scale really poorly, to the point of causing frequent errors and failures with timeouts, deadlocks, and so on.
>
> You're right about the testing aspect. If you are concerned about concurrency issues, the only thing to do is learn about concurrency in Java, and test specifically for concurrency (The Grinder is a pretty good open source tool kit for doing that, and of course there are many others). Please keep in mind though that your intended use may be very different from the intended uses of other users of OFBiz, so again if there are things you are concerned about with concurrency or anything else, you should test those things. If you want to increase the chances of something working a certain way in the future in OFBiz itself, you should contribute automated test cases to test those things. It's that simple, and there is no substitute.
>
> Another benefit of doing that testing is you can try out things like you mentioned, ie making all static methods synchronized, and then see what happens!
>
> -David
>
>
> On Sep 3, 2010, at 12:20 PM, Michał Cukierman wrote:
>
> >
> >> You don't need to do that. If
> >> you stick with the higher level tools you will be more productive and
> >> have a lot less to worry about.
> >
> > Are you sure about that?
> > Or you just havn't  had problems with concurrency issues?
> >
> > You can't just use application/framework without knowing whats inside.
> > For the last year I worked for Aerospace and Defence company, and in
> > such cases code quality is critical.
> >
> > It's just a matter of time/load/data sets sizes, or just a bad luck,
> > when such a code will be a problem.
> >
> > I am not fan of "Luck driven development", so I want to clarify my
> > concerns in here. But talking like:
> > "Don't worry, it will work"
> > Is not a good argument.
> >
> > As far as Ofbiz is a small application, it should not be a problem to
> > fix such issues. just find all static public methods invoked from
> > multiple threads and make them synchronized.
> >
> >
> >
> >
> >
> >
> > Dnia 2010-09-03, pią o godzinie 07:16 -0700, Adrian Crum pisze:
> >> As long as you use the tools OFBiz provides, you do not need to worry
> >> about concurrency in Java code. OFbiz is a suite of multi-threaded
> >> applications that serve thousands of simultaneous users.
> >>
> >> A common mistake new users make is to go directly to Java code and they
> >> end up getting mired in details like this. You don't need to do that. If
> >> you stick with the higher level tools you will be more productive and
> >> have a lot less to worry about.
> >>
> >> -Adrian
> >>
> >> On 9/3/2010 6:28 AM, Michał Cukierman wrote:
> >>> Hi,
> >>>
> >>> I am developing custom services and I want to know if invocation of
> >>> public static methods are handled for example in some introspectors or
> >>> in FTL controllers. If no - I am gonna to handle it by my own. But in
> >>> fact I belive I have missed something.
> >>>
> >>> So my question is:
> >>> Is the Ofbiz thread safe?
> >>>
> >>> I do not face issues when working on one machine but in the future I
> >>> excpect more visitors than one.
> >>>
> >>> If (If) those methods are not handled in any places, why don't you use
> >>> synchronized keyword?
> >>>
> >>> Regards,
> >>> Michał Cukierman
> >>>
> >>>
> >>> Dnia 2010-09-03, pią o godzinie 05:55 -0700, Adrian Crum pisze:
> >>>> What exactly do you need to know? Are you running into any concurrency issues?
> >>>>
> >>>> -Adrian
> >>>>
> >>>> --- On Fri, 9/3/10, Michał Cukierman<[hidden email]>  wrote:
> >>>>
> >>>>> From: Michał Cukierman<[hidden email]>
> >>>>> Subject: Re: Ofbiz Concurrency handling
> >>>>> To: [hidden email]
> >>>>> Date: Friday, September 3, 2010, 12:55 AM
> >>>>> Can anyone help me with understandin
> >>>>> Ofbiz concurrency handling?
> >>>>> Is it thread safe?
> >>>>>
> >>>>> Dnia 2010-09-02, czw o godzinie 15:23 +0200, Michał
> >>>>> Cukierman pisze:
> >>>>>> Hello,
> >>>>>>
> >>>>>> I do ofbiz customization with some code changes. At
> >>>>> the moment Im
> >>>>>> extending ecommerce catalog and product structure.
> >>>>> This action requires
> >>>>>> additional services to be implemented.
> >>>>>>
> >>>>>> So, I am wondering how ofbiz implements concurent
> >>>>> programing issues.
> >>>>>> In FTL files in most cases it invokes
> >>>>>> public, static, NOT synchronized methods.
> >>>>>>
> >>>>>> Just an example:
> >>>>>> http://www.java2s.com/Open-Source/Java-Document/ERP-CRM-Financial/SourceTap-CRM/org/ofbiz/product/category/CategoryWorker.java.htm
> >>>>>>
> >>>>>> Are we sure that while invoking:
> >>>>>> i.e. getRelatedCategories
> >>>>>> We get our related categories?
> >>>>>>
> >>>>>> See:
> >>>>>> http://tutorials.jenkov.com/java-concurrency/synchronized.html
> >>>>>> for concurrency basics.
> >>>>>>
> >>>>>> Regards,
> >>>>>> Michał
> >>>>>>
> >>>>>
> >>>>>
> >>>>
> >>>>
> >>>>
> >>>
> >>>
> >
>

Reply | Threaded
Open this post in threaded view
|

How can I make a coupon that offers 4% off any order with a maximum discount of $50?

Vicky Park
In reply to this post by Adrian Crum-2
Hello guys,

I'd like to make a coupon that offers 4% off any order with a maximum
discount of $50. So if your order total before shipping is $2000, you
still get only $50. Do you know if this is possible with the current
functionality?

I checked demo site and "Catalog Manager Application" by Ruth Hoffman.
But I couldn't find what I want. I'm using customized version based on
opentaps 1.0.3.

Any opinion will be welcome. Thank you in advance.

Vicky
Reply | Threaded
Open this post in threaded view
|

Re: How can I make a coupon that offers 4% off any order with a maximum discount of $50?

Ravindra Mandre-2
 Hi,
please refer price rule tab under the catalog component .


Ravindra Mandre

On Thu, Sep 9, 2010 at 6:59 PM, Vicky Park <[hidden email]> wrote:

> Hello guys,
>
> I'd like to make a coupon that offers 4% off any order with a maximum
> discount of $50. So if your order total before shipping is $2000, you still
> get only $50. Do you know if this is possible with the current
> functionality?
>
> I checked demo site and "Catalog Manager Application" by Ruth Hoffman. But
> I couldn't find what I want. I'm using customized version based on opentaps
> 1.0.3.
>
> Any opinion will be welcome. Thank you in advance.
>
> Vicky
>
Reply | Threaded
Open this post in threaded view
|

Re: How can I make a coupon that offers 4% off any order with a maximum discount of $50?

Jacques Le Roux
Administrator
From: "Ravindra Mandre" <[hidden email]>
> Hi,
> please refer price rule tab under the catalog component .

Wrong, price rules are for products, promotions are for orders. So try with what exists in catalog/promotions rules conditions +
actions. If what you need does not exist create your own. You may contribute (Jira+patch)
And once more: we are not Opentaps, so please ask rather on their forum

Jacques

>
> Ravindra Mandre
>
> On Thu, Sep 9, 2010 at 6:59 PM, Vicky Park <[hidden email]> wrote:
>
>> Hello guys,
>>
>> I'd like to make a coupon that offers 4% off any order with a maximum
>> discount of $50. So if your order total before shipping is $2000, you still
>> get only $50. Do you know if this is possible with the current
>> functionality?
>>
>> I checked demo site and "Catalog Manager Application" by Ruth Hoffman. But
>> I couldn't find what I want. I'm using customized version based on opentaps
>> 1.0.3.
>>
>> Any opinion will be welcome. Thank you in advance.
>>
>> Vicky
>>
>


Reply | Threaded
Open this post in threaded view
|

Re: How can I make a coupon that offers 4% off any order with a maximum discount of $50?

Scott Gray-2
In reply to this post by Vicky Park
Hi Vicky,

I haven't actually looked or tried this, or checked if there is another way but you could create two separate promotions:
- One with a condition that the order total be $2000 or less, the action for this would apply a 4% discount
- Another with a condition that the order total be greater than $2000, the action for this would be a $50 discount

Hope that helps.

Regards
Scott

HotWax Media
http://www.hotwaxmedia.com

On 10/09/2010, at 1:29 AM, Vicky Park wrote:

> Hello guys,
>
> I'd like to make a coupon that offers 4% off any order with a maximum discount of $50. So if your order total before shipping is $2000, you still get only $50. Do you know if this is possible with the current functionality?
>
> I checked demo site and "Catalog Manager Application" by Ruth Hoffman. But I couldn't find what I want. I'm using customized version based on opentaps 1.0.3.
>
> Any opinion will be welcome. Thank you in advance.
>
> Vicky


smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: How can I make a coupon that offers 4% off any order with a maximum discount of $50?

Mukesh Marathe-4
Hi Vicky,

You will have to create single promotion with different conditions and
actions, you can create promotion like this
http://screencast.com/t/Y2I0Mzhm to achieve your requirements.

Thanks,
Mukesh Marathe


On 9/10/2010 1:06 AM, Scott Gray wrote:

> Hi Vicky,
>
> I haven't actually looked or tried this, or checked if there is another way but you could create two separate promotions:
> - One with a condition that the order total be $2000 or less, the action for this would apply a 4% discount
> - Another with a condition that the order total be greater than $2000, the action for this would be a $50 discount
>
> Hope that helps.
>
> Regards
> Scott
>
> HotWax Media
> http://www.hotwaxmedia.com
>
> On 10/09/2010, at 1:29 AM, Vicky Park wrote:
>
>    
>> Hello guys,
>>
>> I'd like to make a coupon that offers 4% off any order with a maximum discount of $50. So if your order total before shipping is $2000, you still get only $50. Do you know if this is possible with the current functionality?
>>
>> I checked demo site and "Catalog Manager Application" by Ruth Hoffman. But I couldn't find what I want. I'm using customized version based on opentaps 1.0.3.
>>
>> Any opinion will be welcome. Thank you in advance.
>>
>> Vicky
>>      
>    

Reply | Threaded
Open this post in threaded view
|

[Solved]Re: MED: Re: How can I make a coupon that offers 4% off any order with a maximum discount of $50?

Vicky Park
Hello all,

Thank you so much guys for your precious time and valuable opinions
which covers almost everything.
I solved this issue, and it works beautiful. - Solved with creating 2
conditions for one promotion.

Thanks Mukesh, screen shot helped much. It worked!.
Thanks Scott, what you said worked!
Thanks Ravindra, I read that part, too.

Thanks Jacques, I read all the stuff I have. So I know how to make
promotion code but didn't think about that more than one condition can
be used to one promotion code.
And about the asking question to ofbiz forum instead of opentaps, I
didn't realized that we have opentaps forum separately. If you know of,
can you please let me know how can I find it?
And I don't think asking a question can be the problem itself. Probably
I should've explained my question in detail, though. My question was, I
just wanted to know if current ofbiz support that functionality. If yes,
then how? If current ofbiz support that functionality, but not my
opentaps, then I was willing to implement that part to our system as I'm
a developer and we use opentaps.
I was in this forum around a year reading valuable issues everyday. I
just mentioned opentaps version because I noticed that lots of time,
when a person ask question, the other person ask back "what version are
you using?" That was all.
And in addition, what I got the answer from here works perfectly on our
system, too.

Again, thank you so much  for all the opinions and your precious time,

Regards,
Vicky



On 9/10/2010 12:55 AM, Mukesh wrote:

> Hi Vicky,
>
> You will have to create single promotion with different conditions and
> actions, you can create promotion like this
> http://screencast.com/t/Y2I0Mzhm to achieve your requirements.
>
> Thanks,
> Mukesh Marathe
>
>
> On 9/10/2010 1:06 AM, Scott Gray wrote:
>> Hi Vicky,
>>
>> I haven't actually looked or tried this, or checked if there is
>> another way but you could create two separate promotions:
>> - One with a condition that the order total be $2000 or less, the
>> action for this would apply a 4% discount
>> - Another with a condition that the order total be greater than
>> $2000, the action for this would be a $50 discount
>>
>> Hope that helps.
>>
>> Regards
>> Scott
>>
>> HotWax Media
>> http://www.hotwaxmedia.com
>>
>> On 10/09/2010, at 1:29 AM, Vicky Park wrote:
>>
>>> Hello guys,
>>>
>>> I'd like to make a coupon that offers 4% off any order with a
>>> maximum discount of $50. So if your order total before shipping is
>>> $2000, you still get only $50. Do you know if this is possible with
>>> the current functionality?
>>>
>>> I checked demo site and "Catalog Manager Application" by Ruth
>>> Hoffman. But I couldn't find what I want. I'm using customized
>>> version based on opentaps 1.0.3.
>>>
>>> Any opinion will be welcome. Thank you in advance.
>>>
>>> Vicky
>
>


Reply | Threaded
Open this post in threaded view
|

Re: [Solved]Re: MED: Re: How can I make a coupon that offers 4% off any order with a maximum discount of $50?

Jacques Le Roux
Administrator
From: "Vicky Park" <[hidden email]>

> Hello all,
>
> Thank you so much guys for your precious time and valuable opinions which covers almost everything.
> I solved this issue, and it works beautiful. - Solved with creating 2 conditions for one promotion.
>
> Thanks Mukesh, screen shot helped much. It worked!.
> Thanks Scott, what you said worked!
> Thanks Ravindra, I read that part, too.
>
> Thanks Jacques, I read all the stuff I have. So I know how to make promotion code but didn't think about that more than one
> condition can be used to one promotion code.

Yes, it's not obvious I agree. I hope to refactor this screen a bit in some not too far time. I will introduce dependent dropdowns
from the left to the right (except for quantity). It should makes things much easier... As you answer suggest, I will try aslo to
make the possiblity to create more lines more obvious (hope I'm still clear ;o)

> And about the asking question to ofbiz forum instead of opentaps, I didn't realized that we have opentaps forum separately. If you
> know of, can you please let me know how can I find it?
> And I don't think asking a question can be the problem itself. Probably I should've explained my question in detail, though. My
> question was, I just wanted to know if current ofbiz support that functionality. If yes, then how? If current ofbiz support that
> functionality, but not my opentaps, then I was willing to implement that part to our system as I'm a developer and we use
> opentaps.

No worries, I'm quite sure Opentaps supports it also, as it relies on OFBiz for that (they could have enhanced it though, but I
don't think so)

> I was in this forum around a year reading valuable issues everyday. I just mentioned opentaps version because I noticed that lots
> of time, when a person ask question, the other person ask back "what version are you using?" That was all.
> And in addition, what I got the answer from here works perfectly on our system, too.
>
> Again, thank you so much  for all the opinions and your precious time,

You are welcome, it's just that I have a gut reaction when I see the Opentaps word in the OFBiz forum. I should not, but...
history...

Jacques

> Regards,
> Vicky
>
>
>
> On 9/10/2010 12:55 AM, Mukesh wrote:
>> Hi Vicky,
>>
>> You will have to create single promotion with different conditions and actions, you can create promotion like this
>> http://screencast.com/t/Y2I0Mzhm to achieve your requirements.
>>
>> Thanks,
>> Mukesh Marathe
>>
>>
>> On 9/10/2010 1:06 AM, Scott Gray wrote:
>>> Hi Vicky,
>>>
>>> I haven't actually looked or tried this, or checked if there is another way but you could create two separate promotions:
>>> - One with a condition that the order total be $2000 or less, the action for this would apply a 4% discount
>>> - Another with a condition that the order total be greater than $2000, the action for this would be a $50 discount
>>>
>>> Hope that helps.
>>>
>>> Regards
>>> Scott
>>>
>>> HotWax Media
>>> http://www.hotwaxmedia.com
>>>
>>> On 10/09/2010, at 1:29 AM, Vicky Park wrote:
>>>
>>>> Hello guys,
>>>>
>>>> I'd like to make a coupon that offers 4% off any order with a maximum discount of $50. So if your order total before shipping
>>>> is $2000, you still get only $50. Do you know if this is possible with the current functionality?
>>>>
>>>> I checked demo site and "Catalog Manager Application" by Ruth Hoffman. But I couldn't find what I want. I'm using customized
>>>> version based on opentaps 1.0.3.
>>>>
>>>> Any opinion will be welcome. Thank you in advance.
>>>>
>>>> Vicky
>>
>>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: MED: Re: [Solved]Re: MED: Re: How can I make a coupon that offers 4% off any order with a maximum discount of $50?

Vicky Park
No problem.
Thank you for welcoming me. Hope I can contribute next time. There was
few questions so far I could answer. I just didn't because I've never
send mail to the group. But next time, I'll.

Have great day,

Regards,
Vicky

On 9/10/2010 1:17 PM, Jacques Le Roux wrote:

> From: "Vicky Park" <[hidden email]>
>> Hello all,
>>
>> Thank you so much guys for your precious time and valuable opinions
>> which covers almost everything.
>> I solved this issue, and it works beautiful. - Solved with creating 2
>> conditions for one promotion.
>>
>> Thanks Mukesh, screen shot helped much. It worked!.
>> Thanks Scott, what you said worked!
>> Thanks Ravindra, I read that part, too.
>>
>> Thanks Jacques, I read all the stuff I have. So I know how to make
>> promotion code but didn't think about that more than one condition
>> can be used to one promotion code.
>
> Yes, it's not obvious I agree. I hope to refactor this screen a bit in
> some not too far time. I will introduce dependent dropdowns from the
> left to the right (except for quantity). It should makes things much
> easier... As you answer suggest, I will try aslo to make the
> possiblity to create more lines more obvious (hope I'm still clear ;o)
>
>> And about the asking question to ofbiz forum instead of opentaps, I
>> didn't realized that we have opentaps forum separately. If you know
>> of, can you please let me know how can I find it?
>> And I don't think asking a question can be the problem itself.
>> Probably I should've explained my question in detail, though. My
>> question was, I just wanted to know if current ofbiz support that
>> functionality. If yes, then how? If current ofbiz support that
>> functionality, but not my opentaps, then I was willing to implement
>> that part to our system as I'm a developer and we use opentaps.
>
> No worries, I'm quite sure Opentaps supports it also, as it relies on
> OFBiz for that (they could have enhanced it though, but I don't think so)
>
>> I was in this forum around a year reading valuable issues everyday. I
>> just mentioned opentaps version because I noticed that lots of time,
>> when a person ask question, the other person ask back "what version
>> are you using?" That was all.
>> And in addition, what I got the answer from here works perfectly on
>> our system, too.
>>
>> Again, thank you so much  for all the opinions and your precious time,
>
> You are welcome, it's just that I have a gut reaction when I see the
> Opentaps word in the OFBiz forum. I should not, but... history...
>
> Jacques
>
>> Regards,
>> Vicky
>>
>>
>>
>> On 9/10/2010 12:55 AM, Mukesh wrote:
>>> Hi Vicky,
>>>
>>> You will have to create single promotion with different conditions
>>> and actions, you can create promotion like this
>>> http://screencast.com/t/Y2I0Mzhm to achieve your requirements.
>>>
>>> Thanks,
>>> Mukesh Marathe
>>>
>>>
>>> On 9/10/2010 1:06 AM, Scott Gray wrote:
>>>> Hi Vicky,
>>>>
>>>> I haven't actually looked or tried this, or checked if there is
>>>> another way but you could create two separate promotions:
>>>> - One with a condition that the order total be $2000 or less, the
>>>> action for this would apply a 4% discount
>>>> - Another with a condition that the order total be greater than
>>>> $2000, the action for this would be a $50 discount
>>>>
>>>> Hope that helps.
>>>>
>>>> Regards
>>>> Scott
>>>>
>>>> HotWax Media
>>>> http://www.hotwaxmedia.com
>>>>
>>>> On 10/09/2010, at 1:29 AM, Vicky Park wrote:
>>>>
>>>>> Hello guys,
>>>>>
>>>>> I'd like to make a coupon that offers 4% off any order with a
>>>>> maximum discount of $50. So if your order total before shipping is
>>>>> $2000, you still get only $50. Do you know if this is possible
>>>>> with the current functionality?
>>>>>
>>>>> I checked demo site and "Catalog Manager Application" by Ruth
>>>>> Hoffman. But I couldn't find what I want. I'm using customized
>>>>> version based on opentaps 1.0.3.
>>>>>
>>>>> Any opinion will be welcome. Thank you in advance.
>>>>>
>>>>> Vicky
>>>
>>>
>>
>>
>
>
>