// set up the root fragment first so we'll have incoming buffers available.
{
logger.debug("Setting up root context.");
FragmentContext rootContext = new FragmentContext(bee.getContext(), rootFragment, rootClient, bee.getContext().getFunctionImplementationRegistry());
logger.debug("Setting up incoming buffers");
IncomingBuffers buffers = new IncomingBuffers(rootOperator, rootContext);
logger.debug("Setting buffers on root context.");
rootContext.setBuffers(buffers);
// add fragment to local node.
status.add(new FragmentData(rootFragment.getHandle(), rootFragment.getAssignment(), true));
logger.debug("Fragment added to local node.");
rootRunner = new FragmentExecutor(rootContext, bee, rootOperator, new RootStatusHandler(rootContext, rootFragment));
RootFragmentManager fragmentManager = new RootFragmentManager(rootFragment.getHandle(), buffers, rootRunner);
if(buffers.isDone()){
// if we don't have to wait for any incoming data, start the fragment runner.
bee.addFragmentRunner(fragmentManager.getRunnable());
}else{
// if we do, record the fragment manager in the workBus.
workBus.setFragmentManager(fragmentManager);