You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@reef.apache.org by do...@apache.org on 2015/10/25 05:29:35 UTC

incubator-reef git commit: [REEF-761] Implement ActiveContext.SendMessage() in REEF.NET

Repository: incubator-reef
Updated Branches:
  refs/heads/master 5bc76b966 -> 76e4a4813


[REEF-761] Implement ActiveContext.SendMessage() in REEF.NET

JIRA:
  [REEF-761] https://issues.apache.org/jira/browse/REEF-761

Pull Request:
  Closes #578


Project: http://git-wip-us.apache.org/repos/asf/incubator-reef/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-reef/commit/76e4a481
Tree: http://git-wip-us.apache.org/repos/asf/incubator-reef/tree/76e4a481
Diff: http://git-wip-us.apache.org/repos/asf/incubator-reef/diff/76e4a481

Branch: refs/heads/master
Commit: 76e4a4813fb4fd898cd695da2dfe466ec2f2f5e4
Parents: 5bc76b9
Author: Andrew Chung <af...@gmail.com>
Authored: Fri Oct 9 16:33:01 2015 -0700
Committer: Dongjoon Hyun <do...@apache.org>
Committed: Sun Oct 25 13:17:47 2015 +0900

----------------------------------------------------------------------
 .../ActiveContextClr2Java.cpp                    | 19 +++++++++++++++++++
 lang/cs/Org.Apache.REEF.Bridge/Clr2JavaImpl.h    |  1 +
 .../Bridge/Clr2java/IActiveContextClr2Java.cs    |  2 ++
 .../Bridge/Events/ActiveContext.cs               |  2 +-
 .../Context/IActiveContext.cs                    | 10 +++++++++-
 5 files changed, 32 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/76e4a481/lang/cs/Org.Apache.REEF.Bridge/ActiveContextClr2Java.cpp
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/ActiveContextClr2Java.cpp b/lang/cs/Org.Apache.REEF.Bridge/ActiveContextClr2Java.cpp
index 6e56806..605e01c 100644
--- a/lang/cs/Org.Apache.REEF.Bridge/ActiveContextClr2Java.cpp
+++ b/lang/cs/Org.Apache.REEF.Bridge/ActiveContextClr2Java.cpp
@@ -102,6 +102,25 @@ namespace Org {
 							ManagedLog::LOGGER->LogStart("ActiveContextClr2Java::GetEvaluatorDescriptor");
 							return CommonUtilities::RetrieveEvaluatorDescriptor(_jobjectActiveContext, _jvm);
 						}
+
+						void ActiveContextClr2Java::SendMessage(array<byte>^ message) {
+							ManagedLog::LOGGER->LogStart("ActiveContextClr2Java::SendMessage");
+							JNIEnv *env = RetrieveEnv(_jvm);
+							jclass jclassActiveContext = env->GetObjectClass(_jobjectActiveContext);
+							jmethodID jmidSendMessage = env->GetMethodID(jclassActiveContext, "sendMessage", "([B)V");
+
+							if (jmidSendMessage == NULL) {
+								ManagedLog::LOGGER->Log("jmidSendMessage is NULL");
+								return;
+							}
+
+							env->CallObjectMethod(
+								_jobjectActiveContext,
+								jmidSendMessage,
+								JavaByteArrayFromManagedByteArray(env, message));
+
+							ManagedLog::LOGGER->LogStop("ActiveContextClr2Java::SendMessage");
+						}
 					}
 				}
 			}

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/76e4a481/lang/cs/Org.Apache.REEF.Bridge/Clr2JavaImpl.h
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Bridge/Clr2JavaImpl.h b/lang/cs/Org.Apache.REEF.Bridge/Clr2JavaImpl.h
index b1869eb..0158868 100644
--- a/lang/cs/Org.Apache.REEF.Bridge/Clr2JavaImpl.h
+++ b/lang/cs/Org.Apache.REEF.Bridge/Clr2JavaImpl.h
@@ -72,6 +72,7 @@ namespace Org {
 						  virtual String^ GetId();
 						  virtual String^ GetEvaluatorId();
 						  virtual IEvaluatorDescriptor^ GetEvaluatorDescriptor();
+						  virtual void SendMessage(array<byte>^ message);
 					  };
 
 					  public ref class EvaluatorRequestorClr2Java : public IEvaluatorRequestorClr2Java {

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/76e4a481/lang/cs/Org.Apache.REEF.Driver/Bridge/Clr2java/IActiveContextClr2Java.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Driver/Bridge/Clr2java/IActiveContextClr2Java.cs b/lang/cs/Org.Apache.REEF.Driver/Bridge/Clr2java/IActiveContextClr2Java.cs
index 6ef03f9..a4ea330 100644
--- a/lang/cs/Org.Apache.REEF.Driver/Bridge/Clr2java/IActiveContextClr2Java.cs
+++ b/lang/cs/Org.Apache.REEF.Driver/Bridge/Clr2java/IActiveContextClr2Java.cs
@@ -32,5 +32,7 @@ namespace Org.Apache.REEF.Driver.Bridge.Clr2java
         string GetEvaluatorId();
 
         IEvaluatorDescriptor GetEvaluatorDescriptor();
+
+        void SendMessage(byte[] message);
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/76e4a481/lang/cs/Org.Apache.REEF.Driver/Bridge/Events/ActiveContext.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Driver/Bridge/Events/ActiveContext.cs b/lang/cs/Org.Apache.REEF.Driver/Bridge/Events/ActiveContext.cs
index 6d3f1cb..997229b 100644
--- a/lang/cs/Org.Apache.REEF.Driver/Bridge/Events/ActiveContext.cs
+++ b/lang/cs/Org.Apache.REEF.Driver/Bridge/Events/ActiveContext.cs
@@ -94,7 +94,7 @@ namespace Org.Apache.REEF.Driver.Bridge.Events
 
         public void SendMessage(byte[] message)
         {
-            throw new NotImplementedException();
+            Clr2Java.SendMessage(message);
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/76e4a481/lang/cs/Org.Apache.REEF.Driver/Context/IActiveContext.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Driver/Context/IActiveContext.cs b/lang/cs/Org.Apache.REEF.Driver/Context/IActiveContext.cs
index 53ade72..f2d2ea8 100644
--- a/lang/cs/Org.Apache.REEF.Driver/Context/IActiveContext.cs
+++ b/lang/cs/Org.Apache.REEF.Driver/Context/IActiveContext.cs
@@ -24,6 +24,14 @@ namespace Org.Apache.REEF.Driver.Context
 {
     public interface IActiveContext : IDisposable, IContext, ITaskSubmittable, IContextSubmittable
     {
-        void SendMessage(byte[] message);
+        /// <summary>
+        /// Sends a context message to the Driver. Currently does not work due to the
+        /// original .NET evaluator implementation not propagating ContextConfiguration
+        /// properly via Tang. Work on the new Evaluator is being done in 
+        /// <see href="https://issues.apache.org/jira/browse/REEF-289">REEF-289</see>.
+        /// </summary>
+        /// <param name="message">Message to send</param>
+        /// TODO[JIRA REEF-863]: Test after unblocked by REEF-289
+        void SendMessage(byte[] message); 
     }
 }