Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15
  1. #11
    Senior Member
    Join Date
    Sep 2013
    Location
    Coimbatore
    Posts
    34
    Yes you are right, Client connected server by using COMMAND mode.
    I have a code like below
    public void clearStatus() {
    synchronized (subscribedItems) {
    Set<String> keys = subscribedItems.keySet();
    for (String itemName : keys) {
    listener.clearSnapshot(itemName);
    }
    }
    }

    In feedsimulator.java class I have code like below,
    final HashMap<String, String> removeoldkey = new HashMap<String, String>();
    synchronized (liveratesold) {
    for (Entry<String, RateRow> e : liveratesold.entrySet()) {
    String key = e.getKey();
    if (!liveratesnew.containsKey(liveratesold.get(key))) {
    listener.onDeleteStatus(liveratesold.get(key).getI temName());
    removeoldkey.put(key, liveratesold.get(key).getItemName());
    // liveratesold.remove(liveratesold.get(key).getItemN ame());


    }
    }
    }
    May i call clearStatus feedsimulator class.

  2. #12
    Senior Member
    Join Date
    Sep 2013
    Location
    Coimbatore
    Posts
    34
    Hi,We are facing the issue on COMMAND mode stock deleting. In my case, we are creating a dynamic stock list. So we are operating the stock list dynamically by add, delete and update. This everything works and add, update and delete working while we check on the server in both LS and our remote server and client page also getting reflect.But some times my client page displaying some extra stock details(It already deleted from our remote application). We have confirmed from our server no data available for this stock. But it showing in LS server and client page. We feel it persist in somewhere in LS server even after we deleted key like listener.onDeleteStatus(key);
    For example, we are having 3 stocks like Stock-1, Stock-2, and Stock-3
    Stock-1 Bid-2767 Ask-2769 High-2772 Low-2765
    Stock-2 Bid-2767 Ask-2769 High-2772 Low-2765
    Stock-3 Bid-2767 Ask-2769 High-2772 Low-2765
    We have deleted Stock-3 from our server. In this time it getting deleted from LS and also client page COMMAND changed and displaying only Stock-1 and Stock-2.
    But unfortunately, sometimes showing this Stock-3 on client page. We don't have any source on our server for this Stock-3.
    And also we need to know is there any cache or in-memory storage for Ls. If there is in-memory storage can we clear daily or if we need at a time.

  3. #13
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    919
    Hello rkvino,

    We received your log.

    The log contains a lot of activity, even if in just 3 minutes.
    So, we also need some coordinates to find the cited episode in the log.
    Please specify the name of the item in COMMAND mode involved in the issue, as there are many in the log.
    If possible, please also specify the name of the key that was supposed to be deleted and appeared again.

    What I can say at this stage is that if I do a case-insensitive search for "delete" in the log I can see it only twice.
    In practice, it is the value associated to a custom field, "FeedStatus", which is received from the Data Adapter and then forwarded to the client.
    By the way, I also see the values "ADD" and "UPDATE" associated to this field.

    This raises the suspect that you are not leveraging the items in COMMAND mode in the correct way.

    Let's call "List" the item in COMMAND mode which contains the list of stocks.
    Let's suppose that you would like to delete "Stock-3".
    You have to:
    • create an update event (for instance a Map);
    • set field "key" to "Stock-3";
    • set field "command" to "delete";
    • send the update event for item "List" to Lightstreamer, by invoking listener.update (or listener.smartUpdate).


    In your code, you invoke some listener.onDeleteStatus, but this is not a method from LS APIs, this is still your code.
    So, you should ensure that your onDeleteStatus behaves like I described above.
    You can see what our Portfolio Demo Adapter does, as a reference.

    -------------

    If you add a key to a COMMAND item, it is kept in the item's state.
    This means that other clients subscribing to this item will receive the key as part of the initial snapshot.
    This is the only "in-memory storage" that we apply.
    But if you delete the key in the proper way, it will be removed from the item state and no other caching will apply.

    The Item's state is also cleared when the item is unsubscribed from by all clients; in this case, unsubscribe will also be invoked to your Data Adapter.
    Upon the next client subscription, subscribe will be invoked to your Data Adapter and the item's state will be reconstructed from scratch.

    A third possibility, as already suggested, is that you invoke clearSnapshot.
    Did you try it?
    The code shown seems correct, but I can't find occurrences of "clearSnapshot" in the log.
    Obiously, you can use clearSnapshot only to ensure that no key will be present in the list.

  4. #14
    Senior Member
    Join Date
    Sep 2013
    Location
    Coimbatore
    Posts
    34
    Fir listener.onDeleteStatus I have return code like below in my DataAdapter

    @Override
    public void onDeleteStatus(String itemName) {
    SubscriptionInfo si;
    synchronized (subscribedItems) {
    si = new SubscriptionInfo(new Boolean(false), new Boolean(true));
    subscribedItems.remove(itemName, si);
    onDelete(this.handle, itemName);
    }
    }

  5. #15
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    919
    The code shown is still internal to your Data Adapter and does not reference anything in Lightstreamer Adapter interface.
    I mean that SubscriptionInfo, subscribedItems, and onDelete are still defined in your code.
    So, it is difficult for us to devise any needed change.
    This is furtherly complicated by the fact that the code is inspired in part to our StockQuotesDataAdapter.java code sample (which defines SubscriptionInfo and subscribedItems) and in part by the PortfolioDataAdapter.java code sample (which defines onDelete).

    Anyway, if you manage to invoke onDelete and the implementation of onDelete is the one included in our PortfolioDataAdapter.java, this should correctly send the DELETE command.
    However, we didn't see that reported in the log.
    So, please debug your Adapter to ensure that
    • onDelete is invoked,
    • onDelete invokes listener.smartUpdate with the correct parameters,
    • after the invocation, the Server logs the update as expected (on LightstreamerLogger.subscriptions at DEBUG level).

    If you dump the parameters upon the invocation of listener.smartUpdate, together with the current time, we can help you in comparing those with the log.

 

 

Similar Threads

  1. Replies: 4
    Last Post: October 24th, 2011, 09:33 AM
  2. TIBCO AMS-GI data adapter issue
    By ganeshk in forum Adapter APIs
    Replies: 1
    Last Post: September 22nd, 2010, 06:52 PM
  3. Replies: 3
    Last Post: January 7th, 2010, 08:57 AM
  4. Replies: 4
    Last Post: January 3rd, 2010, 08:03 AM
  5. Problem running JMS stocks demo
    By mnenchev in forum General
    Replies: 3
    Last Post: August 10th, 2009, 03:22 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT +1. The time now is 08:32 AM.