@Before
  public void before() throws ProActiveException, URISyntaxException {
    remoteObjectDeployer = new NamingServiceDeployer();

    final String[] urls = remoteObjectDeployer.getNamingServiceURLs();
    // PROACTIVE-1303 : we replace the default url to test that it can switch to the second
    urls[0] = CentralPAPropertyRepository.PA_COMMUNICATION_PROTOCOL.getValue() + "://foo";
    stub = NamingService.createNamingServiceStub(urls);
  }
Esempio n. 2
0
    private void configure(final long appId, final String namingServiceURL)
        throws FileSystemException, URISyntaxException, ProActiveException, ConfigurationException {

      // create naming service stub with URL and decorate it with local cache
      // use local variables so GC can collect them if something fails
      final NamingService namingService;
      try {
        namingService = NamingService.createNamingServiceStub(namingServiceURL);
      } catch (ProActiveException x) {
        logger.error("Could not access Naming Service", x);
        throw x;
      } catch (URISyntaxException x) {
        logger.error("Wrong Naming Service URI", x);
        throw x;
      }
      final CachingSpacesDirectory cachingDir = new CachingSpacesDirectory(namingService);

      // create scratch data space for this application and register it
      if (nodeScratchSpace != null) {
        applicationScratchSpace = nodeScratchSpace.initForApplication(appId);
        final SpaceInstanceInfo scratchInfo = applicationScratchSpace.getSpaceInstanceInfo();

        boolean registered = false;
        try {
          cachingDir.register(scratchInfo);
          registered = true;
          logger.debug("Scratch space for application registered");
        } catch (SpaceAlreadyRegisteredException e) {
          logger.error("Could not register application scratch space to Naming Service", e);
          throw e;
        } catch (WrongApplicationIdException e) {
          logger.error("Could not register application scratch space to Naming Service", e);
          throw e;
        } finally {
          if (!registered) {
            nodeScratchSpace.close();
          }
        }
      }
      // no exception can be thrown since now
      cachingDirectory = cachingDir;

      // create VFSSpacesMountManagerImpl
      spacesMountManager = new VFSSpacesMountManagerImpl(cachingDirectory);

      // create implementation object connected to the application's
      // configuration
      impl =
          new DataSpacesImpl(appId, spacesMountManager, cachingDirectory, applicationScratchSpace);
    }