Address performance issues caused by the use of an official Xbean-2.4.0.jar library

Source: Internet
Author: User

Recently, we have frequently received the issue of player complaints card progress bar. And the background shows that the execution queue and CPU usage are unusually high

The following code is called when using Xbean, based on the jdb of the call

There will be a globallock.acquire () at the time of setting xmlobject;

When multi-threaded concurrent settings xmlobject cause each other to wait for this globallock cause each thread stuck, queue execution efficiency is not high

So our current solution is to use string concatenation into XML temporarily without Xbean function

Public final Xmlobject set (Xmlobject src) {if (isimmutable ()) {throw new IllegalStateException ("Cannot set the    Value of an immutable Xmlobject ");    } xmlobjectbase obj = underlying (SRC);    Typestoreuser NEWOBJ = this;      if (obj = = null) {Setnil ();    return this;    } if (Obj.isimmutable ()) {Set (Obj.stringvalue ()));      } else {Boolean nosyncthis = PreCheck ();      Boolean nosyncobj = Obj.precheck ();        if (monitor () = = Obj.monitor ()) {if (nosyncthis) {newObj = Setterhelper (obj);          } else {synchronized (monitor ()) {newObj = Setterhelper (obj);        }}} and else if (nosyncthis) {if (nosyncobj) {newObj = Setterhelper (obj);          } else {synchronized (Obj.monitor ()) {newObj = Setterhelper (obj); }}}} else {if (nosyncobj) {synchronized (monitor ()) {           NEWOBJ = Setterhelper (obj);        }} Boolean acquired = FALSE;          try {globallock.acquire ();          acquired = true; Synchronized (monitor ()) {synchronized (Obj.monitor ()) {globallock.release ()              ;              acquired = FALSE;            NEWOBJ = Setterhelper (obj);        }}} catch (Interruptedexception e) {throw new Xmlruntimeexception (e);          } finally {if (acquired) {globallock.release ();  }}}} return (Xmlobject) newObj; }

  

Address performance issues caused by the use of an official Xbean-2.4.0.jar library

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.