qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tr...@apache.org
Subject svn commit: r832557 - in /qpid/trunk/qpid/cpp: bindings/qmf/ruby/qmf.rb src/qmf/engine/ObjectImpl.h src/qpid/management/ManagementAgent.cpp src/qpid/management/ManagementAgent.h
Date Tue, 03 Nov 2009 21:08:59 GMT
Author: tross
Date: Tue Nov  3 21:08:58 2009
New Revision: 832557

URL: http://svn.apache.org/viewvc?rev=832557&view=rev
Log:
QMF fixes:
  - Added immediate notification of agent deletion
  - Fixed some issues with memory management between the wrapped client and the ruby wrapper

Modified:
    qpid/trunk/qpid/cpp/bindings/qmf/ruby/qmf.rb
    qpid/trunk/qpid/cpp/src/qmf/engine/ObjectImpl.h
    qpid/trunk/qpid/cpp/src/qpid/management/ManagementAgent.cpp
    qpid/trunk/qpid/cpp/src/qpid/management/ManagementAgent.h

Modified: qpid/trunk/qpid/cpp/bindings/qmf/ruby/qmf.rb
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/bindings/qmf/ruby/qmf.rb?rev=832557&r1=832556&r2=832557&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/bindings/qmf/ruby/qmf.rb (original)
+++ qpid/trunk/qpid/cpp/bindings/qmf/ruby/qmf.rb Tue Nov  3 21:08:58 2009
@@ -456,7 +456,7 @@
     attr_reader :impl, :agent_key
     def initialize(impl=nil)
       if impl
-        @impl = impl
+        @impl = Qmfengine::ObjectId.new(impl)
       else
         @impl = Qmfengine::ObjectId.new
       end
@@ -594,7 +594,7 @@
     attr_reader :impl
     def initialize(kwargs = {})
       if kwargs.include?(:impl)
-        @impl = kwargs[:impl]
+        @impl = Qmfengine::Query.new(kwargs[:impl])
       else
         package = ''
         if kwargs.include?(:key)

Modified: qpid/trunk/qpid/cpp/src/qmf/engine/ObjectImpl.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qmf/engine/ObjectImpl.h?rev=832557&r1=832556&r2=832557&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qmf/engine/ObjectImpl.h (original)
+++ qpid/trunk/qpid/cpp/src/qmf/engine/ObjectImpl.h Tue Nov  3 21:08:58 2009
@@ -56,7 +56,7 @@
 
         void destroy();
         const ObjectId* getObjectId() const { return objectId.get(); }
-        void setObjectId(ObjectId* oid) { objectId.reset(oid); }
+        void setObjectId(ObjectId* oid) { objectId.reset(new ObjectId(*oid)); }
         const SchemaObjectClass* getClass() const { return objectClass; }
         Value* getValue(const std::string& key) const;
         void invokeMethod(const std::string& methodName, const Value* inArgs, void* context)
const;

Modified: qpid/trunk/qpid/cpp/src/qpid/management/ManagementAgent.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/management/ManagementAgent.cpp?rev=832557&r1=832556&r2=832557&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/management/ManagementAgent.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/management/ManagementAgent.cpp Tue Nov  3 21:08:58 2009
@@ -44,9 +44,11 @@
 
 ManagementAgent::RemoteAgent::~RemoteAgent ()
 {
-    if (mgmtObject != 0)
-        mgmtObject->resourceDestroy();
     QPID_LOG(trace, "Remote Agent removed bank=[" << brokerBank << "." <<
agentBank << "]");
+    if (mgmtObject != 0) {
+        mgmtObject->resourceDestroy();
+        agent.deleteObjectNowLH(mgmtObject->getObjectId());
+    }
 }
 
 ManagementAgent::ManagementAgent () :
@@ -443,6 +445,32 @@
     }
 }
 
+void ManagementAgent::deleteObjectNowLH(const ObjectId& oid)
+{
+    ManagementObjectMap::iterator iter = managementObjects.find(oid);
+    if (iter == managementObjects.end())
+        return;
+    ManagementObject* object = iter->second;
+    if (!object->isDeleted())
+        return;
+
+#define DNOW_BUFSIZE 2048
+    char     msgChars[DNOW_BUFSIZE];
+    uint32_t contentSize;
+    Buffer   msgBuffer(msgChars, DNOW_BUFSIZE);
+
+    encodeHeader(msgBuffer, 'c');
+    object->writeProperties(msgBuffer);
+    contentSize = msgBuffer.getPosition();
+    msgBuffer.reset();
+    stringstream key;
+    key << "console.obj.1.0." << object->getPackageName() << "." <<
object->getClassName();
+    sendBuffer(msgBuffer, contentSize, mExchange, key.str());
+    QPID_LOG(trace, "SEND Immediate(delete) ContentInd to=" << key.str());
+
+    managementObjects.erase(oid);
+}
+
 void ManagementAgent::sendCommandComplete (string replyToKey, uint32_t sequence,
                                             uint32_t code, string text)
 {
@@ -871,7 +899,7 @@
 
     assignedBank = assignBankLH(requestedAgentBank);
 
-    RemoteAgent* agent = new RemoteAgent;
+    RemoteAgent* agent = new RemoteAgent(*this);
     agent->brokerBank = brokerBank;
     agent->agentBank  = assignedBank;
     agent->routingKey = replyToKey;

Modified: qpid/trunk/qpid/cpp/src/qpid/management/ManagementAgent.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/management/ManagementAgent.h?rev=832557&r1=832556&r2=832557&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/management/ManagementAgent.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/management/ManagementAgent.h Tue Nov  3 21:08:58 2009
@@ -113,11 +113,13 @@
     //
     struct RemoteAgent : public Manageable
     {
+        ManagementAgent&  agent;
         uint32_t          brokerBank;
         uint32_t          agentBank;
         std::string       routingKey;
         ObjectId          connectionRef;
         qmf::org::apache::qpid::broker::Agent*    mgmtObject;
+        RemoteAgent(ManagementAgent& _agent) : agent(_agent) {}
         ManagementObject* GetManagementObject (void) const { return mgmtObject; }
         virtual ~RemoteAgent ();
     };
@@ -212,6 +214,7 @@
 
     void writeData ();
     void periodicProcessing (void);
+    void deleteObjectNowLH(const ObjectId& oid);
     void encodeHeader       (framing::Buffer& buf, uint8_t  opcode, uint32_t  seq = 0);
     bool checkHeader        (framing::Buffer& buf, uint8_t *opcode, uint32_t *seq);
     void sendBuffer         (framing::Buffer&             buf,



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message