Saros
Distributed Collaborative Editing and Distributed Party Programming
|
Public Member Functions | |
void | exec (IActivity activity) |
Implementations of this class can be ISarosSession.addActivityConsumer(IActivityConsumer) registered to the SarosSession}, so they will be informed when new activities are ready to be exec(IActivity) executed}.
Usually, you want your consumer to be selective, i.e. just interested in certain kinds of activities; you want it to be simple, i.e. you don't want to dispatch activities among several instances, because you only have one recipient anyway; you want it to be isolated, i.e. it does not matter whether other consumers get activities before or after you.
If this describes your consumer pretty well, you probably want to use a AbstractActivityConsumer and register it to the Saros Session.
If your consumer is not isolated or otherwise needs custom dispatching (e.g. in a certain order or to certain recipients), you'll need to override the exec(IActivity) method, like in this example:
public class MyConsumingThingy { ... private IActivityConsumer otherConsumer = new IActivityConsumer() { @Override public void exec(IActivity activity) { // do this first } };
private IActivityConsumer consumer = new IActivityConsumer() { @Override public void exec(IActivity activity) { otherConsumer.exec(activity); // do this after } };
void start() { sarosSession.addActivityConsumer(consumer); }
void stop() { sarosSession.removeActivityConsumer(consumer); } }
void de.fu_berlin.inf.dpp.session.IActivityConsumer.exec | ( | IActivity | activity | ) |
Executes the given activity.
Implementations may expect that this method is called from the UI thread (EDT).
Implemented in de.fu_berlin.inf.dpp.editor.RemoteEditorManager, de.fu_berlin.inf.dpp.stf.server.rmi.controlbot.manipulation.impl.NetworkManipulatorImpl, and de.fu_berlin.inf.dpp.core.editor.RemoteEditorManager.