Restore angularObject correctly

This commit is contained in:
Lee moon soo 2016-02-19 19:56:48 -08:00
parent 1f03ebbb6e
commit 5047217ed3
3 changed files with 12 additions and 16 deletions

View file

@ -19,20 +19,20 @@ package org.apache.zeppelin.interpreter.remote;
import org.apache.zeppelin.display.AngularObject;
import org.apache.zeppelin.display.AngularObjectListener;
import org.apache.zeppelin.interpreter.InterpreterGroup;
/**
* Proxy for AngularObject that exists in remote interpreter process
*/
public class RemoteAngularObject extends AngularObject {
private transient RemoteInterpreterProcess remoteInterpreterProcess;
private transient InterpreterGroup interpreterGroup;
RemoteAngularObject(String name, Object o, String noteId, String paragraphId, String
interpreterGroupId,
AngularObjectListener listener,
RemoteInterpreterProcess remoteInterpreterProcess) {
RemoteAngularObject(String name, Object o, String noteId, String paragraphId,
InterpreterGroup interpreterGroup,
AngularObjectListener listener) {
super(name, o, noteId, paragraphId, listener);
this.remoteInterpreterProcess = remoteInterpreterProcess;
this.interpreterGroup = interpreterGroup;
}
@Override
@ -45,8 +45,9 @@ public class RemoteAngularObject extends AngularObject {
if (emitRemoteProcess) {
// send updated value to remote interpreter
remoteInterpreterProcess.updateRemoteAngularObject(getName(), getNoteId(), getParagraphId()
, o);
interpreterGroup.getRemoteInterpreterProcess().
updateRemoteAngularObject(
getName(), getNoteId(), getParagraphId(), o);
}
}
}

View file

@ -129,12 +129,7 @@ public class RemoteAngularObjectRegistry extends AngularObjectRegistry {
@Override
protected AngularObject createNewAngularObject(String name, Object o, String noteId, String
paragraphId) {
RemoteInterpreterProcess remoteInterpreterProcess = getRemoteInterpreterProcess();
if (remoteInterpreterProcess == null) {
throw new RuntimeException("Remote Interpreter process not found");
}
return new RemoteAngularObject(name, o, noteId, paragraphId, getInterpreterGroupId(),
getAngularObjectListener(),
getRemoteInterpreterProcess());
return new RemoteAngularObject(name, o, noteId, paragraphId, interpreterGroup,
getAngularObjectListener());
}
}

View file

@ -382,7 +382,7 @@ public class Notebook {
//
// therefore instead of addAndNotifyRemoteProcess(), need to use add()
// that results add angularObject only in ZeppelinServer side not remoteProcessSide
//registry.add(name, snapshot.getAngularObject().get(), noteId, paragraphId);
registry.add(name, snapshot.getAngularObject().get(), noteId, paragraphId);
}
}
}