protected void startTransport() throws Exception {
    if (container != null) {
      IAcceptor acceptor = getAcceptor();
      LifecycleUtil.activate(acceptor);

      IConnector connector = getConnector();
      LifecycleUtil.activate(connector);
    }
  }
  @Override
  protected void doSetUp() throws Exception {
    super.doSetUp();
    // create container for JVM or TCP only.
    container = createContainer();
    LifecycleUtil.activate(container);

    if (!useJVMTransport() && useSSLTransport()) {
      // the SSL need separate container between client and server
      separateContainer = createContainer();
      LifecycleUtil.activate(separateContainer);
    }
  }
  protected void restartContainer() throws Exception {
    msg("RESTARTING CONTAINER"); // $NON-NLS-1$
    stopTransport();

    LifecycleUtil.deactivate(container);
    container = createContainer();
    LifecycleUtil.activate(container);

    if (!useJVMTransport() && useSSLTransport()) {
      LifecycleUtil.deactivate(separateContainer);
      separateContainer = createContainer();
      LifecycleUtil.activate(separateContainer);
    }
    startTransport();
    msg("RESTARTING CONTAINER - FINISHED"); // $NON-NLS-1$
  }
  public void testAcceptorDefOpensConnection() {
    JVMAcceptorDef jvmAcceptorDef = Net4jDefsFactory.eINSTANCE.createJVMAcceptorDef();
    jvmAcceptorDef.setBufferProvider(Net4jDefsFactory.eINSTANCE.createBufferPoolDef());
    jvmAcceptorDef.setExecutorService(Net4jUtilDefsFactory.eINSTANCE.createThreadPoolDef());
    jvmAcceptorDef.setName(NAME);

    IJVMAcceptor jvmAcceptor = (IJVMAcceptor) jvmAcceptorDef.getInstance();

    assertEquals(true, LifecycleUtil.isActive(jvmAcceptor));

    LifecycleUtil.activate(jvmConnector);
    jvmConnector.waitForConnection(DELAY + TIMEOUT);

    assertEquals(true, LifecycleUtil.isActive(jvmConnector));

    LifecycleUtil.deactivate(jvmAcceptor);
  }
 public void activate(ComponentContext context) throws Exception {
   Object rn = context.getProperties().get(REPO_NAME_PROPERTY);
   Object componentName = context.getProperties().get("component.name");
   String repoName = rn instanceof String ? (String) rn : String.valueOf(componentName);
   repository =
       CDOServerUtil.createRepository(
           repoName, createStore(context), getRepositoryProperties(context));
   LifecycleUtil.activate(repository);
 }
Exemple #6
0
  /** @category Repository */
  public InternalRepository restartRepository(String name) {
    IRepositoryConfig repositoryConfig = getRepositoryConfig();

    try {
      repositoryConfig.setRestarting(true);
      InternalRepository repo = getRepository(name);
      LifecycleUtil.deactivate(repo);
      return getRepository(name);
    } finally {
      repositoryConfig.setRestarting(false);
    }
  }
 @Override
 protected void doTearDown() throws Exception {
   try {
     sleep(20);
     LifecycleUtil.deactivate(container);
   } finally {
     connector = null;
     acceptor = null;
     container = null;
     if (!useJVMTransport() && useSSLTransport()) {
       separateContainer = null;
     }
     super.doTearDown();
   }
 }
 private ExecutorService createThreadPool() {
   ExecutorService threadPool = Executors.newCachedThreadPool();
   LifecycleUtil.activate(threadPool);
   return threadPool;
 }
 private IBufferPool createBufferPool() {
   IBufferPool bufferPool = Net4jUtil.createBufferPool();
   LifecycleUtil.activate(bufferPool);
   return bufferPool;
 }
 @Override
 protected void doTearDown() throws Exception {
   LifecycleUtil.deactivate(jvmConnector);
 }
 public void deactivate() {
   if (repository != null) {
     LifecycleUtil.deactivate(repository);
   }
 }
 @Override
 protected void doActivate() throws Exception {
   super.doActivate();
   LifecycleUtil.activate(delegate);
 }
 @Override
 protected void doDeactivate() throws Exception {
   LifecycleUtil.deactivate(delegate);
   super.doDeactivate();
 }
 protected void deactivateRepository() {
   LifecycleUtil.deactivate(repository);
   repository = null;
 }
 protected void activateRepository(IRepository repository) {
   LifecycleUtil.activate(repository);
 }