예제 #1
0
 /*
  * (non-Javadoc)
  * @see org.eclipse.orion.internal.server.servlets.hosting.ISiteHostingService#get(org.eclipse.orion.internal.server.servlets.site.SiteConfiguration, org.eclipse.orion.internal.server.servlets.workspace.WebUser)
  */
 @Override
 public IHostedSite get(SiteConfiguration siteConfig, WebUser user) {
   // Note this may overlap with a concurrent start()/stop() call that modifies the map
   String id = siteConfig.getId();
   String userId = user.getId();
   for (IHostedSite site : sites.values()) {
     if (site.getSiteConfigurationId().equals(id) && site.getUserId().equals(userId)) {
       return site;
     }
   }
   return null;
 }
예제 #2
0
  /*
   * (non-Javadoc)
   * @see org.eclipse.orion.internal.server.servlets.hosting.ISiteHostingService#stop(org.eclipse.orion.internal.server.servlets.site.SiteConfiguration, org.eclipse.orion.internal.server.servlets.workspace.WebUser)
   */
  @Override
  public void stop(SiteConfiguration siteConfig, WebUser user) throws SiteHostingException {
    synchronized (sites) {
      IHostedSite site = get(siteConfig, user);
      if (site == null) {
        return; // Already stopped; nothing to do
      }

      if (!sites.remove(site.getHost(), site)) {
        throw new ConcurrentModificationException("Table was modified concurrently");
      }
    }
  }