[PATCH 6/7] The getCache() method is missing for the MamaDQPublisher in JAVA API.


Gary Molloy <GMolloy@...>
 

Testing

 

To test this simply run the attached MamaProxy_OMAMA-265.java example application. This will test getCache() for both the MamaDQPublisher and MamaDQPublisherManager.

Expect to see the following output upon subscribing to a symbol:


Received New Request: SPY
TEST:: Got the publishermanager cache for SPY
TEST:: This was contained with the cache for this publisher "SPY"
...

The example app saves off the symbol name in the cache, which is applied to both the dqpublishermanager and dqpublisher.

In the onMsg() these are retrieved using the new api and displayed.

 

 

 

 

From ffb31b9b18d32fcbaf0f4e646d6d96909841fe7d Mon Sep 17 00:00:00 2001

From: Gary Molloy <gmolloy@...>

Date: Mon, 23 Jun 2014 16:35:49 +0100

Subject: [PATCH 6/7] The getCache() method is missing for the MamaDQPublisher in JAVA API.

 

[OMAMA-265]

 

Description - The getCache() method is available in C++ but was not included in JAVA.  Now JAVA has the same functionality that C++.

 

Signed-off-by: Gary Molloy <gmolloy@...>

---

mama/jni/src/com/wombat/mama/MamaDQPublisher.java  | 23 +++++++++++++++++++

.../com/wombat/mama/MamaDQPublisherManager.java    | 26 ++++++++++++++++++++--

2 files changed, 47 insertions(+), 2 deletions(-)

 

diff --git a/mama/jni/src/com/wombat/mama/MamaDQPublisher.java b/mama/jni/src/com/wombat/mama/MamaDQPublisher.java

index 366f5ad..f4c77e2 100644

--- a/mama/jni/src/com/wombat/mama/MamaDQPublisher.java

+++ b/mama/jni/src/com/wombat/mama/MamaDQPublisher.java

@@ -32,6 +32,9 @@ public class MamaDQPublisher

               /*A long value containing a pointer to the underlying C dqpublisher structure*/

               private long dqPublisherPointer_i = 0;

+    /* Object container to hold the user supplied cache */

+    private Object myCache;

+

               static

               {

                               initIDs();

@@ -145,4 +148,24 @@ public class MamaDQPublisher

                                                                               "before invoking create()");

                               }

               }

+

+    /**

+     * Set a cache for the MamaDQPublisher

+     *

+     * @param cache The cache to save against the publisher

+     */

+    public void setCache (Object cache)

+    {

+        myCache = cache;

+    }

+

+    /**

+     * Return the cache for the MamaDQPublisher

+     *

+     * @return Object The cache for the publisher

+     */

+    public Object getCache()

+    {

+        return myCache;

+    }

}

diff --git a/mama/jni/src/com/wombat/mama/MamaDQPublisherManager.java b/mama/jni/src/com/wombat/mama/MamaDQPublisherManager.java

index 533a59b..171efac 100644

--- a/mama/jni/src/com/wombat/mama/MamaDQPublisherManager.java

+++ b/mama/jni/src/com/wombat/mama/MamaDQPublisherManager.java

@@ -22,6 +22,7 @@

package com.wombat.mama;

 import java.util.ArrayList;

+import java.util.Iterator;

 /**

  * The <code>MamaDQPublisherManager</code> interface represents a collection of subscriptions.

@@ -109,7 +110,7 @@ public class MamaDQPublisherManager

      */

     public MamaDQPublisher removePublisher (String symbol)

     {

-        checkIsCreated("addPublisher");

+        checkIsCreated("removePublisher");

         return _removePublisher(symbol);

     }

    

@@ -120,7 +121,7 @@ public class MamaDQPublisherManager

      */

     public void destroyPublisher (String symbol)

     {

-        checkIsCreated("addPublisher");

+        checkIsCreated("destroyPublisher");

         _destroyPublisher(symbol);

     }

    

@@ -140,6 +141,7 @@ public class MamaDQPublisherManager

         MamaDQPublisher myPub = new MamaDQPublisher();

         MamaPublishTopic myTopic = new MamaPublishTopic(symbol, myPub, cache);

         _createPublisher (symbol, myPub, myTopic);

+        myPub.setCache(cache);

         myTopics.add (myTopic);

         return myPub;

               }

@@ -295,4 +297,24 @@ public class MamaDQPublisherManager

                                               return symbol;

                               }

               }

+

+    /**

+     * Accessor for the internal ArrayList that contains all the current publishers

+     *

+     * @param symbol The symbol for the which you want to get the cache

+     *

+     * @return The cache associated with the symbol/publisher

+     */

+    public static Object getCache(String symbol)

+    {

+        Iterator it = myTopics.iterator();

+        while(it.hasNext())

+        {

+            MamaPublishTopic myTopic = (MamaPublishTopic) it.next();

+            if (myTopic.getSymbol().equals(symbol))

+                return myTopic.getCache();

+        }

+        return null;

+    }

+

}

--

1.8.3.1

 


This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of IntercontinentalExchange Group, Inc. (ICE), NYSE Euronext or any of their subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.


Damian Maguire <DMaguire@...>
 

Cheers Gary, raised in Bugzilla as BZ136, we'll follow up with code review there.

D

From: Gary Molloy <GMolloy@...>
Date: Tuesday, June 24, 2014 10:53 AM
To: "openmama-dev@..." <openmama-dev@...>
Subject: [Openmama-dev] [PATCH 6/7] The getCache() method is missing for the MamaDQPublisher in JAVA API.

Testing

 

To test this simply run the attached MamaProxy_OMAMA-265.java example application. This will test getCache() for both the MamaDQPublisher and MamaDQPublisherManager.

Expect to see the following output upon subscribing to a symbol:


Received New Request: SPY
TEST:: Got the publishermanager cache for SPY
TEST:: This was contained with the cache for this publisher "SPY"
...

The example app saves off the symbol name in the cache, which is applied to both the dqpublishermanager and dqpublisher.

In the onMsg() these are retrieved using the new api and displayed.

 

 

 

 

From ffb31b9b18d32fcbaf0f4e646d6d96909841fe7d Mon Sep 17 00:00:00 2001

From: Gary Molloy <gmolloy@...>

Date: Mon, 23 Jun 2014 16:35:49 +0100

Subject: [PATCH 6/7] The getCache() method is missing for the MamaDQPublisher in JAVA API.

 

[OMAMA-265]

 

Description - The getCache() method is available in C++ but was not included in JAVA.  Now JAVA has the same functionality that C++.

 

Signed-off-by: Gary Molloy <gmolloy@...>

---

mama/jni/src/com/wombat/mama/MamaDQPublisher.java  | 23 +++++++++++++++++++

.../com/wombat/mama/MamaDQPublisherManager.java    | 26 ++++++++++++++++++++--

2 files changed, 47 insertions(+), 2 deletions(-)

 

diff --git a/mama/jni/src/com/wombat/mama/MamaDQPublisher.java b/mama/jni/src/com/wombat/mama/MamaDQPublisher.java

index 366f5ad..f4c77e2 100644

--- a/mama/jni/src/com/wombat/mama/MamaDQPublisher.java

+++ b/mama/jni/src/com/wombat/mama/MamaDQPublisher.java

@@ -32,6 +32,9 @@ public class MamaDQPublisher

               /*A long value containing a pointer to the underlying C dqpublisher structure*/

               private long dqPublisherPointer_i = 0;

+    /* Object container to hold the user supplied cache */

+    private Object myCache;

+

               static

               {

                               initIDs();

@@ -145,4 +148,24 @@ public class MamaDQPublisher

                                                                               "before invoking create()");

                               }

               }

+

+    /**

+     * Set a cache for the MamaDQPublisher

+     *

+     * @param cache The cache to save against the publisher

+     */

+    public void setCache (Object cache)

+    {

+        myCache = cache;

+    }

+

+    /**

+     * Return the cache for the MamaDQPublisher

+     *

+     * @return Object The cache for the publisher

+     */

+    public Object getCache()

+    {

+        return myCache;

+    }

}

diff --git a/mama/jni/src/com/wombat/mama/MamaDQPublisherManager.java b/mama/jni/src/com/wombat/mama/MamaDQPublisherManager.java

index 533a59b..171efac 100644

--- a/mama/jni/src/com/wombat/mama/MamaDQPublisherManager.java

+++ b/mama/jni/src/com/wombat/mama/MamaDQPublisherManager.java

@@ -22,6 +22,7 @@

package com.wombat.mama;

 import java.util.ArrayList;

+import java.util.Iterator;

 /**

  * The <code>MamaDQPublisherManager</code> interface represents a collection of subscriptions.

@@ -109,7 +110,7 @@ public class MamaDQPublisherManager

      */

     public MamaDQPublisher removePublisher (String symbol)

     {

-        checkIsCreated("addPublisher");

+        checkIsCreated("removePublisher");

         return _removePublisher(symbol);

     }

    

@@ -120,7 +121,7 @@ public class MamaDQPublisherManager

      */

     public void destroyPublisher (String symbol)

     {

-        checkIsCreated("addPublisher");

+        checkIsCreated("destroyPublisher");

         _destroyPublisher(symbol);

     }

    

@@ -140,6 +141,7 @@ public class MamaDQPublisherManager

         MamaDQPublisher myPub = new MamaDQPublisher();

         MamaPublishTopic myTopic = new MamaPublishTopic(symbol, myPub, cache);

         _createPublisher (symbol, myPub, myTopic);

+        myPub.setCache(cache);

         myTopics.add (myTopic);

         return myPub;

               }

@@ -295,4 +297,24 @@ public class MamaDQPublisherManager

                                               return symbol;

                               }

               }

+

+    /**

+     * Accessor for the internal ArrayList that contains all the current publishers

+     *

+     * @param symbol The symbol for the which you want to get the cache

+     *

+     * @return The cache associated with the symbol/publisher

+     */

+    public static Object getCache(String symbol)

+    {

+        Iterator it = myTopics.iterator();

+        while(it.hasNext())

+        {

+            MamaPublishTopic myTopic = (MamaPublishTopic) it.next();

+            if (myTopic.getSymbol().equals(symbol))

+                return myTopic.getCache();

+        }

+        return null;

+    }

+

}

--

1.8.3.1

 


This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of IntercontinentalExchange Group, Inc. (ICE), NYSE Euronext or any of their subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.

This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of Intercontinental Exchange, Inc. (ICE), Euronext or any of their subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.