Permalink
Browse files

fixed at_exit

  • Loading branch information...
1 parent 94ce4b5 commit f2a25d55c8cbba9bc12efe02de02a9e5ff14126b @adamjmurray adamjmurray committed Aug 27, 2010
@@ -42,7 +42,8 @@ public Object eval(CharSequence rubyCode) {
}
public void exit() {
- // TODO
+ container.terminate();
container = null;
+
}
}
@@ -365,7 +365,9 @@ private void buildArrayString(Object o, StringBuilder s) {
}
}
+ /*
public void on_context_destroyed(Object callback) {
ScriptEvaluatorManager.registerContextDestroyedListener(maxObject, callback.toString());
}
+ */
}
@@ -47,7 +47,7 @@
private static Map<String, ScriptEvaluator> evaluatorContexts = new HashMap<String, ScriptEvaluator>();
private static Map<String, Integer> evaluatorContextCounter = new HashMap<String, Integer>();
- private static MappedSet<String, String> evaluatorContextDestroyedListeners = new MappedSet<String, String>();
+ //private static MappedSet<String, String> evaluatorContextDestroyedListeners = new MappedSet<String, String>();
private static MappedSet<String, Object> objectsUsingEvaluator = new MappedSet<String, Object>();
private static Map<String, Map<String, Object>> maxObjectMap = new HashMap<String, Map<String, Object>>();
private static Constructor<ScriptEvaluator> evaluatorConstructor;
@@ -179,6 +179,7 @@ private static String getEvaluatorContext(String maxContext, Object maxObject) {
}
}
+ /*
public static void registerContextDestroyedListener(Object maxObject, String callbackMethod) {
String[] contextAndId = objectMetadata.get(maxObject);
if (contextAndId != null) {
@@ -187,10 +188,12 @@ public static void registerContextDestroyedListener(Object maxObject, String cal
evaluatorContextDestroyedListeners.addValue(evaluatorContext, callbackMethod);
}
}
+ */
public static void notifyContextDestroyedListener(String maxContext, Object maxObject) {
String evaluatorContext = getEvaluatorContext(maxContext, maxObject);
ScriptEvaluator ruby = evaluatorContexts.get(evaluatorContext);
+ /*
Collection<String> callbackMethods = evaluatorContextDestroyedListeners.remove(evaluatorContext);
if (ruby != null && callbackMethods != null) {
for (String callbackMethod : callbackMethods) {
@@ -203,6 +206,7 @@ public static void notifyContextDestroyedListener(String maxContext, Object maxO
}
}
}
+ */
if (ruby != null) {
// The callback method behavior above should be phased out in favor of this:
ruby.exit();

0 comments on commit f2a25d5

Please sign in to comment.