Need a help to update coherence cache values in c++

Hi,
I need to update coherence cache value of a particular object.
Managed<ExposureHolderContract>::Handle contract =
cast<Managed<ExposureHolderContract>::Handle>(cache->get(vsName));
contract->setName("dsafd");
When i try to cast to a ManagedObject:: Handle it says
coherence::lang::ConstCastException: attempt to cast from a "const coherence::lang::Managed<ExposureHolderContract>" to a "coherence::lang::Managed<ExposureHolderContract>"
at void coherence::lang::coh_throw_const_cast(const std::type_info&, const std::type_info&)(ConstCastException.cpp:27)
at coherence::lang::coh_throw_const_cast(std::type_info const&, std::type_info const&)
<stack frame symbol unavailable>
<stack frame symbol unavailable>
<stack frame symbol unavailable>
<stack frame symbol unavailable>
<stack frame symbol unavailable>
at __libc_start_main
on thread "main"
In the documentation it says in order to call non static methods we need to retrieve the handle.
but when I try to cast to a handle it fails.
I'm inserting data to coherence cache by calling Managed::create method. Is this method making immutable object.
ExposureHolderContract tempEhc(contractId, name, date, age, weight);
Managed<ExposureHolderContract>::Handle ss = Managed<ExposureHolderContract>::create(tempEhc);
cache->put(String::create(contractId.c_str()), ss);
Please help me to update the recorde value.
regards,
sura

Hi Sura,
It is a matter of safety and correctness. The in-process caches return a locally held object, and thus if you made some change to it, that change would be visible within the in-process cache, while not visible to the remote cache. Thus future access to the in-process cache would see a value which does not actually exist in the remote cache. While it is true that if you modify it with the intent to immediately re-insert it this shrinks the window of incorrectness that window still exists, and of course the cache has no idea if you will ever reinsert the value. As for the effect on performance it should be insignificant if you actually do put it back in the cache as the cost of a cache update will easily be multiple orders of magnitude greater then the cost of the clone. Also remember there is no requirement to clone a value if you don't intend to mutate it, you can safely use it via the View. So the only time the performance cost of the clone could be considered significant is when you intend to mutate but not reinsert the data, but a clone is also necessary there as not cloning it would leave the in-process cache in an inconsistent state with respect to the remote cache.
Mark
Oracle Coherence

Similar Messages

  • Need a help on Update statement

    Hi All,
    I Need a help in updating a table column. PFB my requirement.
    Table1
    ItemID OrgId       Date
    1       82     12/sep/2012   
    2       82     25/oct/2012
    3       82     17/Nov/2012
    4     82     22/Jan/2013
    5     82     26/sep/2012
    Table2
    Itemid     orgid       Date1
    1      82     23/sep/2012      
    2      82     25/Dec/2012
    3      82     17/Sep/2012
    4      82     22/Feb/2013
    5      82     26/Oct/2012
    Table3
    Itemid     orgid       Date3
    1      82     10/sep/2012      
    7      82     30/Dec/2012
    3      82     12/Sep/2012
    10      82     27/Feb/2013
    5      82     29/Oct/2012
    I Need to Update Date column of Table1 With Date3 of table3
    If
    Item and org combination is present in table3 and date column of table1 is less than Date3 of table3
    Else
    I need to Update with date2 of table2.Can we acheive this in a single update statement, can any one help me on this.
    Thanks and regards,
    Rakesh
    Edited by: Venkat Rakesh on Sep 27, 2012 11:04 PM

    You can probably also use MERGE:
    --DROP TABLE table1;
    --DROP TABLE table2;
    --DROP TABLE table3;
    ALTER SESSION SET nls_language = 'AMERICAN';
    CREATE TABLE table1
       itemid    CHAR (1),
       orgid     CHAR (2),
       thedate   DATE
    INSERT INTO table1   SELECT '1', '82', TO_DATE ('10/sep/2011', 'dd/mon/yyyy') FROM DUAL;
    INSERT INTO table1   SELECT '2', '82', TO_DATE ('10/oct/2011', 'dd/mon/yyyy') FROM DUAL;
    INSERT INTO table1   SELECT '3', '82', TO_DATE ('10/nov/2011', 'dd/mon/yyyy') FROM DUAL;
    INSERT INTO table1   SELECT '4', '82', TO_DATE ('10/jan/2011', 'dd/mon/yyyy') FROM DUAL;
    INSERT INTO table1   SELECT '5', '82', TO_DATE ('10/sep/2011', 'dd/mon/yyyy') FROM DUAL;-- won't be updated
    CREATE TABLE table2
       itemid    CHAR (1),
       orgid     CHAR (2),
       thedate   DATE
    INSERT INTO table2   SELECT '1', '82', TO_DATE ('01/sep/2012', 'dd/mon/yyyy') FROM DUAL;
    INSERT INTO table2   SELECT '2', '82', TO_DATE ('01/dec/2012', 'dd/mon/yyyy') FROM DUAL;
    INSERT INTO table2   SELECT '3', '82', TO_DATE ('01/sep/2012', 'dd/mon/yyyy') FROM DUAL;
    INSERT INTO table2   SELECT '4', '82', TO_DATE ('01/feb/2012', 'dd/mon/yyyy') FROM DUAL;
    CREATE TABLE table3
       itemid    CHAR (1),
       orgid     CHAR (2),
       thedate   DATE
    INSERT INTO table3   SELECT '2', '82', TO_DATE ('30/dec/2009', 'dd/mon/yyyy') FROM DUAL; -- date less than table1, so picks from table2
    INSERT INTO table3   SELECT '4', '82', TO_DATE ('30/mar/2013', 'dd/mon/yyyy') FROM DUAL; -- larger than table1 , so pick this date
    -- table1 original data
    SELECT * FROM table1;
    -- merge new data
    MERGE INTO table1
         USING (SELECT NVL (t1.itemid, t2.itemid) itemid,
                       NVL (t1.orgid, t2.orgid) orgid,
                       t2.thedate prefdate ,
                       t1.thedate nextdate
                  FROM    table2 t1
                       FULL OUTER JOIN
                          table3 t2
                       ON t1.itemid = t2.itemid AND t1.orgid = t2.orgid) dat
            ON (dat.itemid = table1.itemid AND dat.orgid = table1.orgid)
    WHEN MATCHED
    THEN
       UPDATE SET table1.thedate = (case when prefdate > table1.thedate then prefdate else nextdate end) ;
    --table1 updated data
    SELECT * FROM table1;OUTPUT:
    Session altered.
    Table created.
    1 row created.
    1 row created.
    1 row created.
    1 row created.
    1 row created.
    Table created.
    1 row created.
    1 row created.
    1 row created.
    1 row created.
    Table created.
    1 row created.
    1 row created.
    ITEMID ORGID THEDATE  
    1      82    10.09.2011
    2      82    10.10.2011
    3      82    10.11.2011
    4      82    10.01.2011
    5      82    10.09.2011
    5 rows selected.
    4 rows merged.
    ITEMID ORGID THEDATE  
    1      82    01.09.2012
    2      82    01.12.2012
    3      82    01.09.2012
    4      82    30.03.2013
    5      82    10.09.2011
    5 rows selected.

  • Prevent multiple users from updating coherence cache data at the same time

    Hi,
    I have a web application which have a huge amount of data instead of storing the data in Http Session are storing it in coherence. Now multiple groups of users can use or update the same data in coherence. There are 100's of groups with several thousand users in each group. How do I prevent multiple users from updating the cache data. Here is the scenario. User logs-in checks in coherence if the data there and gets it from coherence and displays it on the ui if not get it from backend i.e. mainframe systems and store it in coherence before displaying it on the screen. Now some other user at the same time can also perform the same function and if don't find the data in coherence can get it from backend and start saving it in coherence while the other user is also in the process of saving or updating. How do I prevent this in coherence. As have to use the same key when storing in coherence because the same data is shared across users and don't want to keep multiple copies of the same data. Is there something coherence provides out-of-the-box or what is best approach to handle this scenario.
    Thanks

    Hi,
    actually I believe, that if we are speaking about multiple users each with its own HttpSession, in case of two users accessing the same session attribute in their own session, the actually used cache keys will not be the same.
    On the other hand, this is probably not what you would really like, you would possibly like to share that data among sessions.
    You should probably consider using either read-through caching with the CacheLoader implementor doing the expensive data retrieval (if the data to be cached can be obtained outside of an HTTP container), or side caching with using Coherence locks or entry-processors for concurrency control on the data retrieval operations for the same key (take care of retries in this case).
    Best regards,
    Robert

  • Need some help in Rounding a double value to a whole number

    Hey Peeps,
    Need some help here, I got a method that returns a value in double after a series of calculation.
    I need to know how can I round the double value, so for example,
    1. if the value is 62222.22222222, it rounds to 62222 and
    2. if the value is 15555.555555, it rounds to 15556
    How can i do this
    Zub

    Hi Keerthi- Try this...
    1. if the value is 62222.22222222, it rounds to 62222 and
    double d = 62222.22222222;long l = (int)Math.round(d * 100); // truncatesd = l / 100.0;
    double d = 62222.22222222;
    System.out.println(d);
    long l = (int)Math.round(d * 100);
    // truncatesSystem.out.println(l);
    d = l / 100.0;System.out.println(d);
    for (int i = 0; i < 1000; i++)
    {    d -= 0.1;}
    for (int i = 0; i < 1000; i++)
    {    d += 0.1;}System.out.println(d);
    regards- Julie Bunavicz
    Output:
    62222.22222222
    62222
    62222.22
    62222.22000000000001

  • I NEED SOME HELP WITH UPDATING MY IPOD TOUCH PLEASE

    i need some help with my ipod the version is 3.1.3 and every time I'm trying to update it says it can not be restored then it says unknown error so i need some help updating my ipod to version 4.2

    If you mean you're trying to update your ios go to settings/general/software update. then you should see the latest ios just tap it and it will automatically update your ipod. If you're trying to restore your ipod (as it's not quite clear in your query) try doing it through itunes instead of on the device itself

  • Need Search help to appear on Multiple Value Screen - Monitor SC

    Hello All,
    We have a requirement where we need to add a new field in Monitor Shopping Cart screen. This field is at the item level and should be able to take in multiple values.
    The problem we face is - On getting the multiple value screen, the search help for the field is dissappearing.
    We already have a standard field 'Purchase Group' for which this functionality is provided and the search help works for the multiple value screen.
    Please provide any pointers to how to fix the problem. Would the problem be on the ABAP side or the HTML side?
    Thank you.
    Johnson

    Hi,
    Jsut to see in the error is on abap side, sign on in SRM sapgui and run /n then bbp_mon_sc to enter the monitor SC application.
    Navigate till your Zdevelopment field and check it
    Kind regards,
    Yann

  • Please i need a help in updating my nokia 5800

    Hello everybody
    please I need a help
    when i am updating my nokia in to v40 from v21 using nokia update software it begins downloading but when it reaches 20 mb it returns a lot of times at last it said you have a low internet connectivity
    otherwise when i enter *#0000# and check for updates they said no updates are found
    what is the solution of my problems I have still try updating for more than 5  days but nothing has been changed.
    Can a body upload the update in others serves espically in mediafire sinnce mediafire is the best site for me to download from? please I need the update since my nokia now is slow and after update it will have new things and ofcourse will be speed up.
    please can anyone upload it using www.mediafire.com and thanks so much
    I want it quickly, and only mediafire for downloading working on my bad internet connectivity

    For performing a firmware update you need an high speed internet connection i dont know whats the speed of internet connection you are using, in this case you can go to nokia care point and get it updated. Thats safe and you won't brick your phone too. Firmware updates can be done only through nokia software updater application and through the phone(fota)by the end user and there is no way to put the update file to some place or server like what you asked for.
    If a reply has solved your problem click Accept as solution button, doing it will help others know the solution. Thanks.

  • Need some help on updating the KDE wiki page (for KDE 4.4)

    Could somebody help on updating it ? Especially for deprecated sections.
    Thank you very much.

    You have a significant number of code errors (65) which makes trouble shooting layout issues nearly impossible.
    [Invalid] Markup Validation of http://www.getouttohunterdon.com/Things%20to%20Do%20in%20Hunterdon.html - W3C …
    Also, DO NOT USE SPACES in file or folder names. They are invalid in HTML5 and on the web, spaces are converted to %20 characters which can lead to link errors. Use DW's Files Panel (F2) to rename your files without spaces.  You can use underscores_ hyphens- or dots. but no other special characters.  Allow DW to update links for you.  Then fix the remaining code errors. If that doesn't resolve your layout issues, post back with your cleaned up page and we'll take another look at it.
    Nancy O.

  • Help with updating a column value

    I have a table
    create table library_Test
    CLIENTID NUMBER (11),
    PROPERTYID NUMBER (11),
    DOCID NUMBER (2),
    DATECREATED DATE
    Insert into library_test values(99999,12345,1,sysdate)
    Insert into library_test values(88888,45678,2,sysdate)
    Now I add in a column libraryid which will identity each row
    alter table library_test add libraryid number(11)
    Now I want to generate libraryIDs say 1,2 and so on for the number of rows in the table. I want libraryid as 1 for the first record created
    based on datecreated.
    So I want my output to look like this
    clientid propertyid docid datecreated libraryid
    99999 12345 1 6/26/2007 2:04:30 PM 1
    88888 45678 2 6/26/2007 2:04:56 PM 2
    Can this be possible to do. If its not possible based on datecreated, how do I insert ids into this table so it will have a uniqueness to a row.
    Oracle version is 9.2.0.1.0
    Any help is appreciated.
    Thanks,
    Priya.

    SQL> select * FROM library_Test;
      CLIENTID PROPERTYID      DOCID DATECREAT  LIBRARYID
         99999      12345          1 28-JUN-07
         88888      45678          2 28-JUN-07
    SQL> update library_Test aa set aa.libraryid =
      2  (select rn from (select CLIENTID,PROPERTYID,row_number() over (partition by trunc(DATECREATED) order by DATECREATED) rn from library_Test)
      3  where CLIENTID = aa.CLIENTID and PROPERTYID = aa.PROPERTYID);
    2 rows updated.
    SQL> commit;
    Commit complete.
    SQL> select * FROM library_Test;
      CLIENTID PROPERTYID      DOCID DATECREAT  LIBRARYID
         99999      12345          1 28-JUN-07          1
         88888      45678          2 28-JUN-07          2
    SQL>

  • I need some help with updating my MUVO

    Hi guys! I have gb muvo 200. At the moment the veersion of my firm ware is . 02. 0. I want to uggade it to a newer one (_05_02). I downloaded it but when I start it it says put you mp3 player in reocvery mode. I knew how to do that and I did it. But then when I sart the program is does not find my player! It is just searching for ages! So I cant update it((((((((((((((( Help please!)

    Here's a step-by-step list of what to do to upgrade your player. Let me know which steps fail and why.
    Download and install latest drivers file.</LI>
    Download latest firmware for V200.</LI>
    Press and hold Play button on V200 and then connect it to your USB port.</LI>
    Run through Add Hardware Wizard (use Find Automatically method) to setup drivers for Recovery Mode.</LI>
    Run firmware installer program.</LI>
    PB

  • Need urgent help with update!

    hi
    i tried to update my ipod vid to software v1.2 from itunes and i get a message saying
    'The ipod could not be updated. an unknown error occured (1417)'
    so i figured if i restored my ipod that would fix the problem, well i cant seem to restore it either.
    If i attempt to restore it i get an identical message except it has 1428 at teh end instead of 1417.
    Also before i get the error message a box appears in the top of my screen and starts scrolling through all the artists on my ipod, looks like its scanning it or something i dont know.
    any help would be REALLY appreciated as i cant get new videos or games onto my ipod until i get the update working.
    cheers,
    ipod video 5G   Windows XP Pro  

    Check this thread out.
    http://discussions.apple.com/thread.jspa?messageID=3172375&#3172375

  • Need you help to update business area for FI Document  generated  at migo

    HI guys
    I am looking for MIGO Badi or user-exit which will help update business area which is mandatory field but when movement type 101and the account assignment tab is not there when the movement type is 101 at the time of GR so i want to update it BA in for FI Document generate  in background so as to complete the GR. 
    Thanks

    Hi Niraj ,
    I Have check the badi but there is no structure of FI item data  generated for which i can insert the BA for the line item generated
    Thanks
    Regards
    Nilesh

  • Plz i need your help , i updated my iphone 3G for ver6.0.1 but now its not work , what can i do ??

    Dear Sir/Mom
    now i updated my iphone 3G for the version 6.0.1 but now its not work , what can i do plz help me
    thank you

    What doesn't work?
    Has the iPhone been jailbroken?
    Do you have the app Cydia on your iPhone?

  • Need a help to Update Infotype.....

    Hi Experts,
    *am developing HR-ABAP Report inthat, i have data in 2 internal tables, through these (itabs) i want to*
    *insert the data into 2 Ztables(Respective tables) and then i want to Update one Custom Infotype.*
    how can i procedure for this? is there any FM to update Infotype....
    Thanks in Advance,
    sudeer.

    The best way is to use HR_INFOTYPE_OPERATION function module in your program.
    Sample code:
          call function 'HR_INFOTYPE_OPERATION'
            exporting
              infty         = p0082-infty
              number        = p0082-pernr
              subtype       = p0082-subty
              validityend   = p0082-endda
              validitybegin = p0082-begda
              record        = p0082
              operation     = 'INS'
              tclas         = 'A'
              dialog_mode   = '0'
            importing
              return        = return
              key           = key.
         capture error messages
          if return-type = 'E'.
            concatenate 'Sub Type:' p0082-infty into messtab-tcode.
            move return-message to messtab-param.
            append messtab. clear messtab.
          endif.
    You can use it for modifying the record also.

  • I need some help I updated my ipad last night to the new ios....but it deleted all the applications on it? Any way that I can restore the ipad to what it was before I updated it? Or is there a way to get them all back?

    Can anyone help?

    That's part of the process - the upgrade removes all the apps and then (as part of the syncing) restores them all - however, it's not clear that it's doing that. Connect your iPad to iTunes again and sync it - the apps should come back. If not, then the upgrade created a back-up of your device before installing - you can restore your iPad to that back-up when connected to iTunes.

Maybe you are looking for