When are return values' memory released?

I have been trying to optimize a particular query and have run out of ideas. In this query I have user defined functions which returns about 1600 results per document. I have tried running it with live values and lazy results from both my Java app and the dbxml shell both have similar behavior. If I run 1 document it runs in about 8 seconds and memory continuously climbs to a high of about 350mb which occurs at the end of the query run. When I call delete on the XmlResult object all of the memory is released.
Now if I do the query over two documents the memory climbs to about 400mb and levels off there at which point it seems the results come back significantly slower as if the database is doing something else; maybe determining where it can free memory. Overall it takes the query about 90 seconds to complete. If I try something like:
local:run-query( (: will look in doc1 :) .... ) | local:run-query( (: will look in doc2 :) .... ) instead of local:run-query( (: will look in doc1 and doc2 :) .... )
The performance is more of what I would have expected: runs in 17 seconds and continuously climbs in memory to about 700mb which occurs at the end of the query.
So I guess my question would be is this behavior by design and why does it hang on to so much memory even though I do delete on the XmlValue result as soon as I get it back?
I can post the query and give an idea of how the data is formatted if it would help. Any insight that anyone has will be helpful.
I should note that I am using version 2.3.10 on windows xp. The machine is a Pentium 4 3.00GHz with 1GB of ram
Thanks in advance,
Pralit
Message was edited by:
user580792

George,
My documents are about 11MB as an xml file (should be about 180,000 elements). For the
moment there are only 2 documents in my container although it could get as high as 30 but not
typically. With 2 documents the size of the container is 56MB. I create the environment in Java
using the following config:
EnvironmentConfig envConfig = new EnvironmentConfig();
envConfig.setAllowCreate(true);
envConfig.setCacheSize(100 * 1024 * 1024 );
envConfig.setInitializeCache(true);
envConfig.setInitializeLocking(true);
I have tried a cache size of 500mb but didn't notice much of a change in performance.
I feel you are right about my query defeating the lazy evaluation. All the looping for the sums in
the get-weighted-eff function seems to be the cause for a lot of the memory use. Also the newly
created element results would probably not be lazily returned (although these seem to get
deleted promptly).
Anyways my query and an example of the data follow . Any suggestion on what I can do to
reduce the memory if at all possible would be great. As I said before I am out of ideas.
Thanks,
Pralit
The Data:
<scenario name="Keyword-All" date="2007-8-11T18:46:52-00:00'">
<world>
  <region name="USA" type="region">  <!-- 14 per document, Global implies all regions -->
   <supplysector name="electricity" type="sector">  <!-- 32 sectors per region -->
    <subsector name="nuclear" type="subsector">  <!-- 1-4 per sector -->
     <technology year="1990" name="Gen_II_LWR" type="technology">  <!-- 3-7 per subsector -->
      <output-primary name="electricity" type="output">  <!-- could be up to 3 sets of inputs/ouputs per technology -->
       <physical-output unit="EJ" vintage="1990">2.20172</physical-output>
      </output-primary>
      <input-non-energy name="non-energy" type="input">
       <price-paid unit="1975$/GJ" vintage="1990">5.8</price-paid>
       <IO-coefficient unit="unitless" vintage="1990">1</IO-coefficient>
      </input-non-energy>
      <input-energy name="nuclearFuelGenII" type="input">
       <price-paid unit="1975$/GJ" vintage="1990">0.20381</price-paid>
       <demand-physical unit="EJ" vintage="1990">6.61177</demand-physical>
       <IO-coefficient unit="unitless" vintage="1990">3.003</IO-coefficient>
      </input-energy>
      <keyword primary-renewable="nuclear-elect"/>  <!-- keywords are only in select technologies about 2000 total in a document -->
     </technology>
....The Query:
declare function local:get-weighted-eff($outputs as node()*) as node()* {
   unordered {
     for $year in distinct-values($outputs/@vintage)
     let $eff_unweight := sum(for $res in $outputs[@vintage = $year]
                       let $eff_curr := $res/parent::*/following-sibling::input-energy/IO-coefficient[@vintage = $year]                       return $res div $eff_curr),
             $weight := sum($outputs[@vintage = $year]),
             $eff_weighted := $eff_unweight div $weight
     return element efficiency-weighted {attribute year { $year }, text { $eff_weighted }}
declare function local:append-heirarchy($parent as node(), $append as node()) as node() {
let $scn := $parent/ancestor::scenario,
          $rgn := $parent/ancestor::region
   return 
          document { element scenario { $scn/@*,
                                                element region {
                                                        $rgn/@*,
                                                        $append
(: I can get by with just the scenario and region
let $new_node := element {local-name($parent)} {$parent/@*, $append}  
return 
if(local-name($parent) != 'scenario')
then local:append-heirarchy($parent/parent::*, $new_node)
else document { $new_node } :)
declare function local:get-primary-renewable($outputs as node()*, $weighted_effs as node()*) as node()* {
unordered {   
for $output in $outputs
let $new_output :=   element input {
         attribute type {'input'},
         attribute name {$output/parent::*/following-sibling::keyword/@primary-renewable},
         element demand-physical {
                 attribute vintage {$output/@vintage},
                 attribute unit {$output/@unit},
                 text { $output div $weighted_effs[@year=$output/@vintage] }
$new_root := local:append-heirarchy($output/parent::*/parent::*, $new_output)
return $new_root//text()
declare function local:run-primary-energy($scenarios as xs:string*, $regions as xs:string*, $collection as xs:string) as node()* {
unordered {   
let $regionsG := if(not($regions[1] = 'Global'))
                  then $regions                  else distinct-values(collection($collection)/scenario/world/region/@name)
return 
for $scenario in $scenarios,      
$region in $regionsG  
let $scenario_split := tokenize($scenario, ' '),                          
$currTree := collection($collection)/scenario[@name = $scenario_split[1] and @date = $scenario_split[2]]/world/region[@name=$region]
return (: get renewables from electricity :)
local:get-primary-renewable($currTree/supplysector[@name='electricity']//keyword[fn:exists(@primary-renewable)]/preceding-sibling::output-primary/physical-output,
   local:get-weighted-eff($currTree/supplysector[@name='electricity']//keyword[fn:exists(@average-fossil-efficiency)]/preceding-sibling::output-primary/physical-output))        
| (: get renewables from H2ProdCS :)
local:get-primary-renewable($currTree/supplysector[@name='H2ProdCS']//keyword[fn:exists(@primary-renewable)]/preceding-sibling::output-primary/physical-output,
   local:get-weighted-eff($currTree/supplysector[@name='H2ProdCS']//keyword[fn:exists(@average-fossil-efficiency)]/preceding-sibling::output-primary/physical-output))        
| (: get renewables from H2ProdDist :)
local:get-primary-renewable($currTree/supplysector[@name='H2ProdDist']//keyword[fn:exists(@primary-renewable)]/preceding-sibling::output-primary/physical-output,
   local:get-weighted-eff($currTree/supplysector[@name='H2ProdDist']//keyword[fn:exists(@average-fossil-efficiency)]/preceding-sibling::output-primary/physical-output))        
| (: get the primaries :)
$currTree//keyword[fn:exists(@primary-consumption)]/preceding-sibling::input-energy/demand-physical/node()
local:run-primary-energy(('Keyword-All 2007-8-11T18:46:52-00:00'), ('Global'), 'temp2.dbxml')

Similar Messages

  • When are you planning to release a new firmware fo...

    When are you planning to release a new firmware for the N95 NAM?
    I am tired of waiting for the automatic screen rotation on the N95NAM. This feature is aleady available in the european version.
    I switched from an iPhone to this nokia, and now i have second thoughts. Nokia seems to be the same as apple.
    Do you guys know anything about a new firmware?

    No one from Apple will respond. We're all just fellow users here. And all that Apple has announced thus far can be found in the press release:
    http://www.apple.com/pr/library/2012/03/07Apple-Launches-New-iPad.html
    Beyond that, no one here knows anything about future release dates.
    Regards.

  • When are you going to release iOS 6 ?

    I just want to know when are you going to release iOS 6 ?

    At some point in the next 28 hours.
    (69924)

  • SQL - Select Help - Case When? Return Value from Second Table?

    Hi - next to folks on this board I am probably somewhere between a Beginner and an Intermediate SQL user.
    Ive been using a case when statement in plsql to find "all those who's status in any program was cancelled during a specific time, but have become or are still active in a second program"
    So, Im effectively trying to return a value from a second table in a case when, but its not liking anthing other than a declared text like 'Yes' or 'No'.
    Here is the select statement - is there another way to do this where I can get the results I need?
    case when pp.party_id in (select pp1.party_id  -- Cancelled clients Active in another program
                                       from asa.program_participation          pp1,
                                            asa.curr_prog_participation_status cpps1
                                      where pp1.program_participation_id = cpps1.program_participation_id
                                        and pp1.party_id = pp.party_id
                                        and cpps1.code_value = 'ACT')
                then 'Yes' else 'No' end  as Active_in_Other_Prg
    So - in place of 'Yes' i basically want the program that they are active in or pp1.program_id, else Null
    It is possible that the client can be active in more than one program as well.
    Any assistance is greatly appreciated, i explored with if's and decodes but I cant get anything to work.
    Batesey

    Sounds like an outer join. See ora doc: Joins
    select p.*
    ,      q.party_id
    ,      q.program_id
    from   table_with_party_id p
    ,    ( select pp1.party_id  -- Cancelled clients Active in another program
           ,      pp1.program_id
           from   asa.program_participation          pp1,
                  asa.curr_prog_participation_status cpps1
           where  pp1.program_participation_id = cpps1.program_participation_id
           and    pp1.party_id = pp.party_id
           and    cpps1.code_value = 'ACT') q
    where p.party_id = q.party_id ( +)
    Note: In the example above there shoudn't be a space between the ( and +), but the forum software automagically converts this to
    The outer join will link show all records from the p table and only records from q if the party_id matches, ie q.party_id and q.program_id  will be null if there is no match.
    edit: added program_id

  • How to display message when no return values in powershell script?

    Hello,
    I have written following command that returns "Failed" timer job titles for previous day :
    $FailedSPTimerJobs = Get-SPTimerJob | % { $_.HistoryEntries } | Where-Object {($_.StartTime -gt $YesterdayStartDateTime) -and ($_.To -lt $YesterdayEndDateTime) -and ($_.Status -eq 'Failed')}| Select JobDefinitionTitle | ConvertTo-Html -Fragment
    ConvertTo-Html -Body "<font color = blue><H4><B>Report </B></H4></font>$FailedSPTimerJobs " -Title "Test Report" -CssUri C:\style.CSS | Out-File "E:\Reports\Test.html"
    However, I need to display Message ( "There are no Failed Jobs recorded") when records are NULL.
    Would you please let me know how can I achieve this ?
    Thanks and Regards,
    Dipti Chhatrapati

    You could just do something like
    if ($FailedSPTimerJobs){ 
    $FailedSPTimerJobs
    = "There are no Failed Jobs recorded"
    should have been 
    if (!$FailedSPTimerJobs){ 
    $FailedSPTimerJobs
    = "There are no Failed Jobs recorded"

  • When are Creative going to release NEW Audigy 2 ZS drivers? (CAT/ADMINS plz read last pos

    <SPAN>Hi
    <SPAN>First and foremost I would like to emphasise this post is by no means a flame against the hardworking staff at Creative Labs, but more of a curious question.
    <SPAN>I am a relati'vely happy owner of an Audigy 2 ZS Platinum PRO. Apart from a few niggling teething problems which were sorted out extremely well by Technical Support (they even shipped me a newer revision of the driver installation CD free of charge) I have had no problems!!!
    <SPAN>HOWEVER, Doom3 version .3 added OpenAL and EAX 4 support, which as you might have guessed is good news for us Audigy2/ZS/4 owners.
    <SPAN>Unfortunately to get the best out of Doom3 I had to download BETA drivers, this was not really a problem since they are relati'vely stable, but these drivers do have a few niggling problems.
    <SPAN>For Example, the THX Setup console does not remember the speaker position settings. AND Half-Life 2 requires the speakers to be set each time I enter the game.
    <SPAN>E.g each time I load Half-Life 2 I have to set the speakers to 7. surround (pre BETA drivers did not have this problem)
    <SPAN>It would be nice if somebody from Creative was to either release an updated version of the BETA driver (preferably non-BETA), an updated THX setup console, OR to inform us when a new Driver and applications will arri've.
    <SPAN>Not meaning to sound rude, but FOUR MONTHS is rather a long time for a Driver to stay in Beta status.
    <SPAN>Thanks for your time
    <SPAN class=time_text>
    <SPAN>Cat top day to you!
    <SPAN>I have a suggestion, or rather proposition that Im sure allot of folks here will agree with. <IMG height=6 src="http://forums.creative.com/i/smilies/6x6_smiley-happy.gif" width=6 border=0>
    <SPAN>How about instead of the preview site http://preview.creativelabs.com being used exclusi'vely for releasing beta <SPAN>64Bit drivers for public testing (which next to nobody uses). How about you (Creative) extend public beta testing to <SPAN>32Bit drivers and applications for release on the http://preview.creativelabs.com website ?.
    <SPAN>Imho it will make the official drivers much more stable and worthwhile for the average user. It is just a thought and suggestion .<IMG height=6 src="http://forums.creative.com/i/smilies/6x6_smiley-happy.gif" width=6 border=0>
    Message Edited by JohnZS on 08-25-2005 :42 PM

    That would be fantastic CAT if you could fill us in on driver update. 4mths is a bit much.
    I use the beta's ATM jut to test em out and give feed back on how they work.
    Still no EAX in BF2, However I get better performance and no more sound drop out, YAH. TOP JOB TEAM !!!!
    Seem stable and all console apps work fine.
    Though I still get NO eax ( reverb, occlusion ) in the following games.
    Soldier of fortune 2
    Starwars BattleFront
    Call of duty and Call of Duty UO
    Painkiller
    BattleField Vietnam
    GTA SA
    UT 2004.
    Hmm, thats alot of games that STATE EAX that I dont get it with. Even with other drivers I still get no EAX.
    I do get AWESOME EAX in these games though.
    Rainbow SIX raven sheild
    Theif 2 DS
    V8 supercars 2
    Colin MCrea rally 4
    So my card is fine and working perfectly.
    Hope the next set fixes everything up EAX wise.

  • Your flash player 11 keeps crashing windows 8. when are you going to release flash player for win 8

    i've downloade your flashplayer 11 and have had to get rid of it because it's not compatible with windows 8. when willyou have the correct flash player released?

    I must apologize to Pat for my reply to "Flash Player is already embedded in IE10;..."I have found out since that the Flash Player is indeed embedded in IE10.If you go into the IE10 settings and restore it to its default setting you will see.I am sorry for doubting you Pat.

  • Adobe, when are you going to release Creative Cloud worldwide?

    Live in Costa Rica and I've trying AdobeCC last month an now there’s no way to buy the monthly service and my tryout almost gone...

    There is a list of what countries Creative Cloud Membership is currently available on the FAQ here:
    http://www.adobe.com/products/creativecloud/faq.html
    Find the question:
    In what countries can I buy a membership to Creative Cloud? 
    Another related question:
    Creative Cloud isn’t available where I live. When will it become available? 
    We intend to make Creative Cloud as widely available as possible. Adobe will share more details about country availability over time.
    -Dave

  • Webservice : problem with Base64 returned value

    Hello all,
    We are calling a webservice from a Flex2 application.
    When the returned value does not contain accentuated letters,
    we receive the value "as-is", everything is OK.
    When there is at least one accent, the result is
    automatically Base64 encoded by the server, and the
    xsi:type="n2:base64 is specified in the XML answer.
    The problem is that Flex2 does not Base64 decode the returned
    string, ans we cannot get the right value.
    We do not think that the problem is on the server, because we
    tryied to use 2 other webservice clients, and they worked well.
    We wonder if Flex2 can handle Base64 encoding on Webservice
    results or not.
    We thought abut using the Base64 decoder class, but it won't
    work because the result if not *always* Base64 encoded (depending
    if it contains some chars or not).
    Is there any solution to this issue ? If it can help, I paste
    the XML returned by the server at the end of this message.
    Thank you for your help.
    MiF
    <?xml version="1.0" encoding="UTF-8" ?>
    <env:Envelope xmlns:xsd="
    http://www.w3.org/2001/XMLSchema"
    xmlns:env="
    http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="
    http://www.w3.org/2001/XMLSchema-instance">
    <env:Body>
    <n1:GetArticleResponse xmlns:n1="urn:ActionWebService"
    env:encodingStyle="
    http://schemas.xmlsoap.org/soap/encoding/">
    <return xmlns:n2="
    http://schemas.xmlsoap.org/soap/encoding/"
    xsi:type="n2:base64">PD94bWwgdmVyc2lvbj0iMS4xIiBlbmNvZGluZz0iSVNPLTg4NTktMSI/Pgo8
    YXJ0aWNsZXM+CiAgPGFydGljbGU+CiAgICA8aWQ+MTwvaWQ+CiAgICA8Y29k
    ZT5NaXRjaDwvY29kZT4KICA8L2FydGljbGU+CiAgPGFydGljbGU+CiAgICA8
    aWQ+MjwvaWQ+CiAgICA8Y29kZT5Qb2xvPC9jb2RlPgogIDwvYXJ0aWNsZT4K
    ICA8YXJ0aWNsZT4KICAgIDxpZD4zPC9pZD4KICAgIDxjb2RlPkvpa+k8L2Nv
    ZGU+CiAgPC9hcnRpY2xlPgo8L2FydGljbGVzPgo=</return>
    </n1:GetArticleResponse>
    </env:Body>
    </env:Envelope>

    You should use cast_to_varchar2 regardless what is source of base64_encode.
    Because base64-value consists of single byte ASCII-characters.

  • PE03 - Cannot directly enter return values

    Hi all,
    I have a simple feature, the first decision is based on field PERSK (employee sub group) with offset 0 length 1.
    I wish to enter directly custom return values such as 1, 2, 3, 4, 5.
    But it is forcing me to pick return values from an F4 style pop up.
    The problem with using the F4 pop up is currently only Employee sub groups 1* and 2* are configured.
    Hence I cannot enter 3, 4 and 5, because 3, 4 5* employee sub groups are not yet configured in the system.
    I've checked other existnig features (e.g. QUOMO) and they do allow my to directly key in custom return values in a pop up box, regardless of whether they exist in the system or not.
    Any idea why I can do this is one feature and not another feature?
    I need to key in directly my own values.
    Thanks
    Kevin

    Problem solved (not really solved but i found the reason why its happening this way).
    Each feature is making use of a different structure
    It is called "Structure name for decision fields"
    (PE03 -> Attributes -> Struct)
    QUOMO uses structure PME87 which had no check table against its PERSK field (SE11)
    My custom feature was using another structure which had a check table against its PERSK field (SE11)
    After debugging PE03 I realize that if there is a check table, it will enforce a F4 style drop down when creating return values from a decision in the feature.
    Thanks all.
    Kevin

  • Inferring return value assignment types - ever seen this ?

    Consider a class designed to hold arbitrary values defined at runtime. It is backed by a Map<String,Object> and values are stored and retrieved by a String identifier. Basic type checking is also performed.
    Setting the values is straightforward: obj.set(name, value) but I have two candidates for syntax of getters.
    First an example of the obvious approach, where getInteger(&hellip;) performs type checking, casting and explicitly returns an Integer:
    Integer id = obj.getInteger("id") ;This is ok but I discovered a more consice syntax that works without without explicitly naming a type nor sacrificing type safety any further:
    Integer id = obj.get("id") ;In this approach we use a generic method, where the return type is inferred and passed to the method. Here's how I do it:
    // root method that is called by both approaches
    private <K> K _get(String name, Class<K> clz) {
      Object value = map.get(name) ;
      // check for null, assignability, etc.
      if (!clz.isAssignableFrom(value.getClass())) {
          throw new RuntimeException(clz + " is not assignable from " + value.getClass()) ;
      return (K) value ;
    // method 1 - the obvious way
    public Integer getInteger(String name) {
      return _get(name, Integer.class) ;
    // method 2
    public <T> T get(String name, T...ts) {
      if (ts.length > 0) throw new RuntimeException("Illegal usage...") ;
      return (T) _get(name, ts.getClass().getComponentType()) ;
    }This works becaues type T is used for both the var-arg array and the return value. Of course, it probably fails if you provide additional args - you're not supposed to. ts.getClass().getComponentType() returns the type you are assigning the return value to.
    Not many languages can take this into consideration. In a way, it makes the return type part of the signature.
    Advantages:
    - Much smaller API
    - Dynamic extension for use with a new datatype doesn't require adding a new getX() method
    - Members can be treated uniformly, such a through iteration
    Disadvantages:
    - Involve the confusing zero-length var-args in the api that must be ignored
    - Type is inferred to be Object when the return value is not assigned
    At first you might think that the method 1 is more type-safe but in fact it is not. Using method 1 you have to align the method with the assignment type, but you can still exception at runtime. In method2 the datatype is simply inferred.
    I'm interested in your thoughts on this teqnique. Please let me know if you have a way of concealing the var-args oddness. I think this technique could complement various patterns quite well, such as factory.
    Thanks for your input.
    Edited by: crackleOK on Jul 21, 2009 4:46 AM

    crackleOK wrote:
    JoachimSauer wrote:
    The only redeeming quality is that it can be very nice to use such code.API's are to use (and often have ugly guts). Unfortunately true, but not a good reason to write ugly implementation code. If you only care about code quality up to the API, then you only care about the shiny coating of your car as well and don't mind the rust as long as you don't see it.
    As I said: sometimes the tradeoff is worth it, but it should still be weighted.
    Also: the ignorable varargs parameters are not needed in any way whatsoever.Please explain.From what I see you can replace this method:
    public <T> T get(String name, T...ts)
    // with
    public <T> T get(String name)without any loss of functionality.

  • The returned value of BAPI call

    Hi, experts,
    I have a question about returned value of BAPI call.
    when the returned value is mapped as an attribute and this return value itsself is of the type: table of a certain structure. Is there any possibility that the value of this table still can be extracted from the mapped attribute? If it is possible, how?
    If not, how should this kind of situation be handled:
    when the returned value of the function at the backend has more one layer structure?
    Thanks and best regards,
    Fan

    In my experience you shouldn't use the service wizard to generate the context of such deeply nested structures. They don't generate or map correctly because it tries to put the table type as the type of the context attribute.
    Instead you should propery model the relationship in the context using nested nodes. Here is an example of address <-> address text where you can have multiple address texts per address.  From the service this was a returned nested table.
    ****BP Address and Address Text
      data lo_nd_bp_addr type ref to if_wd_context_node.
      data lo_nd_bp_addr_text type ref to if_wd_context_node.
      data lo_el_bp_addr type ref to if_wd_context_element.
    * navigate from <CONTEXT> to <BP_ADDR> via lead selection
      lo_nd_bp_addr = wd_context->get_child_node( name = wd_this->wdctx_bp_addr ).
      lo_nd_bp_addr->bind_table( wd_this->gt_bp_addr ).
    ****Add the Address Text Table as Child of each Address Context Record
      data element_set type wdr_context_element_set.
      field-symbols <wa_set> like line of element_set.
      field-symbols <wa_bp_addr> like line of wd_this->gt_bp_addr.
      element_set = lo_nd_bp_addr->get_elements( ).
      loop at element_set assigning <wa_set>.
        read table wd_this->gt_bp_addr index sy-tabix assigning <wa_bp_addr>.
        lo_nd_bp_addr_text = <wa_set>->get_child_node( name = if_componentcontroller=>wdctx_bp_addr_text ).
        lo_nd_bp_addr_text->bind_table( <wa_bp_addr>-t_text ).
      endloop.

  • LOV query is invalid, a display and a return value are needed

    hello - i am having this issue and can't get around this when creating a popup LOV based on sql.
    below is LOV query. as you see the view has only two columns. I tried various ways by giving alias to columns in query but nothing works. What did I miss here?
    select description,inventory_item_id from xx_apex_inv_v
    1 error has occurred
    LOV query is invalid, a display and a return value are needed, the column names need to be different. If your query contains an in-line query, the first FROM clause in the SQL statement must not belong to the in-line query.

    Did you try it like this?
    select description d, inventory_item_id v from xx_apex_inv_v

  • When i add menu bar in my user interface gives me error that this handle is not a panel handle(return value -42)

    i have 3 panels in my application and parent panel is displayed first then i display other two panels which come to the front then on entering correct password i discard the child panel and then you can see parent panel , but there is an issue when i add menu to my parent panel i dont know whats wrong when i add menu bar in my user interface (parent panel)  gives me error that this handle is not a panel handle(return value -42) for a child panel. when i dont open and display child panel then its fine , and even without menu added to my parent panel all my panels and my application works perfactly

    Hello smartprogrammer,
    some more informations are needed in order to properlu help you in this situation:
    - Are you adding menus dynamically at runtime or in the UIR editor? If dynamically: how are you loading the menu bar?
    - Are you dynamically tailoring the menu bar at runtime (adding or deleting menu items, dimming / undimming some of them or checking / unchecking)?
    - Can you post the code where you are getting the error, documenting variables and scope (local to the function, global to the source file, global to the project)?
    You can look at uirview.prj example that ships with CVI for an example of LoadMenuBar (the exampl eis in <CVI samples>\userint folder): in that project, the menu bar is shown as a context menu when you right-click on a tree element (see DeferredMenuCB callback).

  • How to trap null return values from getters when using Method.invoke()?

    Hi,
    I am using Method.invoke() to access getters in an Object. I need to know which getters return a value and which return null. However, irrespective of the actual return value, I am always getting non-null return value when using Method.invoke().
    Unfortunately, the API documentation of Method.invoke() does not specify how it treats null return values.
    Can someone help?
    Thanks

    What do you get as a result?I think I know what the problem is.
    I tested this using following and it worked fine:
    public class TestMethodInvoke {
    public String getName() {
    return null;
    public static void main(String args[]) throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
    Object o = new TestMethodInvoke();
    Class cls = o.getClass();
    Method m = cls.getMethod("getName", (Class[]) null);
    Object result = m.invoke(o, (Object[])null);
    if (result == null) {
    System.err.println("OK: Return value was null as expected");
    else {
    System.err.println("FAILED: Return value was NOT null as expected");
    However, when I use the same technique with an EJB 3.0 Entity class, the null return value is not returned. Instead, I get a String() object. Clearly, the problem is the the EJB 3.0 implementation (Glassfish/Toplink) which is manipulating the getters.
    Regards
    Dibyendu

Maybe you are looking for