code: private void suspend() throws RepositoryException
     {
        WorkspaceResumer workspaceResumer = getWorkspaceResumer();
        if (workspaceResumer != null)
        {
           workspaceResumer.onSuspend();
        }
  
        List<Suspendable> components = getComponentInstancesOfType(Suspendable.class);
  
        Comparator<Suspendable> c = new Comparator<Suspendable>()
        {
           public int compare(Suspendable s1, Suspendable s2)
           {
              return s2.getPriority() - s1.getPriority();
           };
        };
        Collections.sort(components, c);
  
        for (Suspendable component : components)
        {
           try
           {
              if (!component.isSuspended())
              {
                 component.suspend();
              }
           }
           catch (SuspendException e)
           {
              throw new RepositoryException("Can't suspend component", e);
           }
        }
     }
docs: Suspend all components in workspace.
  
  @throws RepositoryException