org.springframework.context.support.ClassPathXmlApplicationContext.stop()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(164)

本文整理了Java中org.springframework.context.support.ClassPathXmlApplicationContext.stop()方法的一些代码示例,展示了ClassPathXmlApplicationContext.stop()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ClassPathXmlApplicationContext.stop()方法的具体详情如下:
包路径:org.springframework.context.support.ClassPathXmlApplicationContext
类名称:ClassPathXmlApplicationContext
方法名:stop

ClassPathXmlApplicationContext.stop介绍

暂无

代码示例

代码示例来源:origin: apache/incubator-dubbo

@Override
public void stop() {
  try {
    if (context != null) {
      context.stop();
      context.close();
      context = null;
    }
  } catch (Throwable e) {
    logger.error(e.getMessage(), e);
  }
}

代码示例来源:origin: apache/incubator-dubbo

@Override
public void stop() {
  try {
    if (context != null) {
      context.stop();
      context.close();
      context = null;
    }
  } catch (Throwable e) {
    logger.error(e.getMessage(), e);
  }
}

代码示例来源:origin: isuwang/isuwang-soa

@Override
public void stop() {
  if (context != null)
    context.stop();
}

代码示例来源:origin: com.isuwang/isuwang-soa-container

@Override
public void stop() {
  if(context != null)
    context.stop();
}

代码示例来源:origin: spring-projects/spring-integration

@Test
public void applicationContextEvents() {
  ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
      "applicationEventInboundChannelAdapterTests.xml", this.getClass());
  PollableChannel channel = (PollableChannel) context.getBean("channel");
  Message<?> contextRefreshedEventMessage = channel.receive(0);
  assertNotNull(contextRefreshedEventMessage);
  assertEquals(ContextRefreshedEvent.class, contextRefreshedEventMessage.getPayload().getClass());
  context.start();
  Message<?> startedEventMessage = channel.receive(0);
  assertNotNull(startedEventMessage);
  assertEquals(ContextStartedEvent.class, startedEventMessage.getPayload().getClass());
  context.stop();
  Message<?> contextStoppedEventMessage = channel.receive(0);
  assertNotNull(contextStoppedEventMessage);
  assertEquals(ContextStoppedEvent.class, contextStoppedEventMessage.getPayload().getClass());
  context.close();
  Message<?> closedEventMessage = channel.receive(0);
  assertNotNull(closedEventMessage);
  assertEquals(ContextClosedEvent.class, closedEventMessage.getPayload().getClass());
}

代码示例来源:origin: bingyufight/distributed-flexible-transaction

public void run() {
    try {
      context.stop();
      logger.warn("server stopped!!!");
    } catch (Exception e) {
      logger.error(e.getMessage(), e);
    } catch (Throwable t) {
      logger.error(t.getMessage());
    }
    synchronized (TestService1Launcher.class) {
      running = false;
      TestService1Launcher.class.notify();
    }
  }
});

代码示例来源:origin: bingyufight/distributed-flexible-transaction

public void run() {
    try {
      context.stop();
      logger.warn("server stopped!!!");
    } catch (Exception e) {
      logger.error(e.getMessage(), e);
    } catch (Throwable t) {
      logger.error(t.getMessage());
    }
    synchronized (TestService2Launcher.class) {
      running = false;
      TestService2Launcher.class.notify();
    }
  }
});

代码示例来源:origin: bingyufight/distributed-flexible-transaction

public void run() {
    try {
      context.stop();
      logger.warn("server stopped!!!");
    } catch (Exception e) {
      logger.error(e.getMessage(), e);
    } catch (Throwable t) {
      logger.error(t.getMessage());
    }
    synchronized (TransactionServiceLauncher.class) {
      running = false;
      TransactionServiceLauncher.class.notify();
    }
  }
});

代码示例来源:origin: pl.edu.icm.synat/synat-platform-integration-tests

public void stopRegistry() {
  applicationContext.stop();
  applicationContext.close();
}

代码示例来源:origin: hhfcyong/xxxx-dubbo

/**
 * 构造函数,初始化jedis连接池
 */
public redisCluster(){
  try{
    context = new ClassPathXmlApplicationContext("classpath:spring/spring-context.xml");
    context.start();
    jedisCluster = (JedisCluster) context.getBean("jedisCluster");
  }
  catch(Exception e){
    log.error("==>redisCluster context start error:", e);
    context.stop();
    System.exit(0);
  }     
} 
/**

代码示例来源:origin: Talend/tesb-rt-se

public static void main(String args[]) throws Exception {

    ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
        new String[] {"client-context.xml"});

    // By starting the context consumer-side endpoint, that receives
    // callback messages, is started
    context.start();

    // Here request-callback request to the service provider is performed
    context.getBean("tester");
    
    Thread.sleep(120000);

    context.stop();
    context.close();
    System.exit(0);
  }
}

代码示例来源:origin: hhfcyong/xxxx-dubbo

/**
 * 构造函数,初始化jedis连接池
 */
public xxxxJedisPool(){
  try{
    context = new ClassPathXmlApplicationContext("classpath:spring/spring-context.xml");
    context.start();
     pool = (JedisPool) context.getBean("jedisPool"); 
     jedis = pool.getResource();
  }
  catch(Exception e){
    log.error("==>redisCluster context start error:", e);
    context.stop();
    System.exit(0);
  }     
} 
public Jedis getJedis(){

代码示例来源:origin: stackoverflow.com

public static void main(String[] args) throws JMSException, InterruptedException  {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("my-    context.xml");
  context.registerShutdownHook();

  App app = context.getBean("app", App.class);
  app.start();

  context.stop();
}

代码示例来源:origin: com.alibaba/dubbo

@Override
public void stop() {
  try {
    if (context != null) {
      context.stop();
      context.close();
      context = null;
    }
  } catch (Throwable e) {
    logger.error(e.getMessage(), e);
  }
}

代码示例来源:origin: org.apache.dubbo/dubbo-container-spring

@Override
public void stop() {
  try {
    if (context != null) {
      context.stop();
      context.close();
      context = null;
    }
  } catch (Throwable e) {
    logger.error(e.getMessage(), e);
  }
}

代码示例来源:origin: remoting/dubbox

public void stop() {
  try {
    if (context != null) {
      context.stop();
      context.close();
      context = null;
    }
  } catch (Throwable e) {
    logger.error(e.getMessage(), e);
  }
}

代码示例来源:origin: fang-yan-peng/eagle

@Override
  public void stop() {
    try {
      if (context != null) {
        context.stop();
        context.close();
        context = null;
      }
    } catch (Throwable e) {
      logger.error(e.getMessage(), e);
    }
  }
}

代码示例来源:origin: com.alibaba/dubbo-container-spring

@Override
public void stop() {
  try {
    if (context != null) {
      context.stop();
      context.close();
      context = null;
    }
  } catch (Throwable e) {
    logger.error(e.getMessage(), e);
  }
}

代码示例来源:origin: org.apache.dubbo/dubbo

@Override
public void stop() {
  try {
    if (context != null) {
      context.stop();
      context.close();
      context = null;
    }
  } catch (Throwable e) {
    logger.error(e.getMessage(), e);
  }
}

代码示例来源:origin: remoting/dubbox

public void stop() {
  try {
    if (context != null) {
      context.stop();
      context.close();
      context = null;
    }
  } catch (Throwable e) {
    logger.error(e.getMessage(), e);
  }
}

相关文章

微信公众号

最新文章

更多