IC5Notice: We have upgraded developerWorks Community to the latest version of IBM Connections. For more information, read our upgrade FAQ.
Topic
  • 5 replies
  • Latest Post - ‏2013-05-20T22:49:59Z by lisaw
Rooman
Rooman
6 Posts

Pinned topic All Cached Entries from ObjectMap

‏2013-05-10T13:57:02Z |

Hello There,

I have been looking for some way to find all the entries in a map defined in the Grid. Followed - http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r0/index.jsp?topic=%2Fcom.ibm.websphere.extremescale.javadoc.doc%2Ftopics%2Fcom%2Fibm%2Fwebsphere%2Fobjectgrid%2FObjectMap.html but unfortunately do not find any method which returns all the map entries.

Anyone has any idea ?

Thanks,

Rooman

  • lisaw
    lisaw
    101 Posts

    Re: All Cached Entries from ObjectMap

    ‏2013-05-10T17:52:09Z  

    You are on the right track, ObjectMap has getNextKey() you can iterate through and find all entries.

    That's not the most optimized way to search for entries of course, and suggest using an agent and map range index plugin.

        MapRangeIndex index = (MapRangeIndex)map.getIndex("INDEX");
        Iterator keyIterator = index.findAll();
        while (keyIterator.hasNext()) {
          System.out.println(keyIterator.next());
        }
    

    There's a working example of the index in the Liberty airport sample.  I hope that gets you started!

    Updated on 2013-05-10T17:53:46Z at 2013-05-10T17:53:46Z by lisaw
  • Rooman
    Rooman
    6 Posts

    Re: All Cached Entries from ObjectMap

    ‏2013-05-16T10:35:59Z  
    • lisaw
    • ‏2013-05-10T17:52:09Z

    You are on the right track, ObjectMap has getNextKey() you can iterate through and find all entries.

    That's not the most optimized way to search for entries of course, and suggest using an agent and map range index plugin.

    <pre dir="ltr"> MapRangeIndex index = (MapRangeIndex)map.getIndex("INDEX"); Iterator keyIterator = index.findAll(); while (keyIterator.hasNext()) { System.out.println(keyIterator.next()); } </pre>

    There's a working example of the index in the Liberty airport sample.  I hope that gets you started!

    Thanks for the sample link.

    I have another question, assuming that you know pretty well on WXS, is - I see following in the logs 

    ClientDomainC I   CWOBJ1126I: The ObjectGrid client has connected to the XYZGrid grid in the eXtremeScaleDev domain using connection 0

    My concern is every time code tries to hit XS, I see this log with connection value increases by 1, which seems like making new connection everytime. Is there any setting I can do to control that ?

     

    Thanks,

    Syed

  • lisaw
    lisaw
    101 Posts

    Re: All Cached Entries from ObjectMap

    ‏2013-05-16T14:41:17Z  
    • Rooman
    • ‏2013-05-16T10:35:59Z

    Thanks for the sample link.

    I have another question, assuming that you know pretty well on WXS, is - I see following in the logs 

    ClientDomainC I   CWOBJ1126I: The ObjectGrid client has connected to the XYZGrid grid in the eXtremeScaleDev domain using connection 0

    My concern is every time code tries to hit XS, I see this log with connection value increases by 1, which seems like making new connection everytime. Is there any setting I can do to control that ?

     

    Thanks,

    Syed

    Looks like you are creating a new connection every time.  There is a good example when you install the WXS standalone of how to keep your connection then get your objectgrid and session if you have installed WXS 8.6.0.1.  If you don't have it, there's a download for the trial here.

    Look at the code in <WXS_INSTALL>/ObjectGrid/gettingstarted/client/src/com/ibm/websphere/xs/sample/gettingstarted/Client.java, it will give you an example how to keep your connection over multiple transactions.

    That's what I think is happening without seeing your code.

  • Rooman
    Rooman
    6 Posts

    Re: All Cached Entries from ObjectMap

    ‏2013-05-17T10:06:00Z  
    • lisaw
    • ‏2013-05-10T17:52:09Z

    You are on the right track, ObjectMap has getNextKey() you can iterate through and find all entries.

    That's not the most optimized way to search for entries of course, and suggest using an agent and map range index plugin.

    <pre dir="ltr"> MapRangeIndex index = (MapRangeIndex)map.getIndex("INDEX"); Iterator keyIterator = index.findAll(); while (keyIterator.hasNext()) { System.out.println(keyIterator.next()); } </pre>

    There's a working example of the index in the Liberty airport sample.  I hope that gets you started!

    Hello Lisa,

    Your replies are helpful.

    Regarding iteration of Map Objects, I can see there is something like -

    java.util.Map map = targetMap.getJavaMap();

    But when I try to iterate through this it throws me exception :

    Exception in Caching Monitor >> com.ibm.websphere.objectgrid.ClientServerLoaderException: Client Services - Received exception from remote server

    Can you suggest anything here ?

    Syed

     

    Updated on 2013-05-17T14:48:31Z at 2013-05-17T14:48:31Z by Rooman
  • lisaw
    lisaw
    101 Posts

    Re: All Cached Entries from ObjectMap

    ‏2013-05-20T22:49:59Z  
    • Rooman
    • ‏2013-05-17T10:06:00Z

    Hello Lisa,

    Your replies are helpful.

    Regarding iteration of Map Objects, I can see there is something like -

    java.util.Map map = targetMap.getJavaMap();

    But when I try to iterate through this it throws me exception :

    Exception in Caching Monitor >> com.ibm.websphere.objectgrid.ClientServerLoaderException: Client Services - Received exception from remote server

    Can you suggest anything here ?

    Syed

     

    Look at your logs on your server as the client isn't telling you much more than that.  Perhaps you have a transaction error or a timeout on the server side?