Code example for Cache

Methods: asMap

  public FragmentManager getFragmentManager(FragmentHandle handle) throws FragmentSetupException {
    // check if this was a recently canceled fragment.  If so, throw away message. 
    if (recentlyFinishedFragments.asMap().containsKey(handle)) {
      logger.debug("Fragment: {} was cancelled. Ignoring fragment handle", handle);
      return null; 
    // since non-leaf fragments are sent first, it is an error condition if the manager is unavailable. 
    FragmentManager m = managers.get(handle);
    if(m != null){
      return m;
    throw new FragmentSetupException("Failed to receive plan fragment that was required for id: " + QueryIdHelper.getQueryIdentifier(handle));
  public void cancelFragment(FragmentHandle handle) {
    logger.debug("Fragment canceled: {}", QueryIdHelper.getQueryIdentifier(handle));