org.springframework.data.redis.listener.RedisMessageListenerContainer.stop()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(123)

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

RedisMessageListenerContainer.stop介绍

暂无

代码示例

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

public void stop(Runnable callback) {
  stop();
  callback.run();
}

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

public void destroy() throws Exception {
  initialized = false;
  stop();
  if (manageExecutor) {
    if (taskExecutor instanceof DisposableBean) {
      ((DisposableBean) taskExecutor).destroy();
      if (logger.isDebugEnabled()) {
        logger.debug("Stopped internally-managed task executor");
      }
    }
  }
}

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

@Override
public void stop() {
  this.container.stop();
}

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

@Override
public void stop(Runnable callback) {
  this.container.stop(callback);
}

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

@Override
protected void doStop() {
  super.doStop();
  this.container.stop();
}

代码示例来源:origin: com.github.xiaolyuh/layering-cache-core

@Override
public void stop(Runnable callback) {
  container.stop(callback);
}

代码示例来源:origin: org.springframework.integration/spring-integration-redis

@Override
public void stop(Runnable callback) {
  this.container.stop(callback);
}

代码示例来源:origin: org.springframework.integration/spring-integration-redis

@Override
public void stop() {
  this.container.stop();
}

代码示例来源:origin: com.github.xiaolyuh/layering-cache-core

@Override
public void stop() {
  container.stop();
}

代码示例来源:origin: xiaolyuh/layering-cache

@Override
public void stop(Runnable callback) {
  container.stop(callback);
}

代码示例来源:origin: xiaolyuh/layering-cache

@Override
public void stop() {
  container.stop();
}

代码示例来源:origin: org.springframework.data/spring-data-redis

public void stop(Runnable callback) {
  stop();
  callback.run();
}

代码示例来源:origin: apache/servicemix-bundles

public void stop(Runnable callback) {
  stop();
  callback.run();
}

代码示例来源:origin: org.springframework.data/spring-data-redis

public void destroy() throws Exception {
  initialized = false;
  stop();
  if (manageExecutor) {
    if (taskExecutor instanceof DisposableBean) {
      ((DisposableBean) taskExecutor).destroy();
      if (logger.isDebugEnabled()) {
        logger.debug("Stopped internally-managed task executor");
      }
    }
  }
}

代码示例来源:origin: org.springframework.integration/spring-integration-redis

@Override
protected void doStop() {
  super.doStop();
  this.container.stop();
}

代码示例来源:origin: apache/servicemix-bundles

public void destroy() throws Exception {
  initialized = false;
  stop();
  if (manageExecutor) {
    if (taskExecutor instanceof DisposableBean) {
      ((DisposableBean) taskExecutor).destroy();
      if (logger.isDebugEnabled()) {
        logger.debug("Stopped internally-managed task executor");
      }
    }
  }
}

代码示例来源:origin: sentilo/sentilo

private void restartListenerContainer() {
 LOGGER.info("Stopping listener container for process {}", processName);
 try {
  listenerContainer.stop();
 } catch (final Exception re) {
  LOGGER.warn("An error occurred while stopping listener container. If it is not running, we proceed to start it", re.getMessage());
 }
 // Clear count pending events value
 countPendingEvents = 0;
 LOGGER.info("Starting listener container");
 if (!listenerContainer.isRunning()) {
  listenerContainer.start();
 }
}

代码示例来源:origin: sentilo/sentilo

@Override
public void stop() {
 LOGGER.info("Call stop method. Is hook running? {}", running);
 if (running) {
  try {
   // Stop the RedisMessageListenerContainer ...
   listenerContainer.stop();
   // ... wait 2 seconds so that all threads related to the listenerContainer get enough time
   // to do their cleanup ...
   TimeUnit.SECONDS.sleep(2);
   // ... and finally call custom agent stop process to ensure that no pending works are lost
   // during shutdown
   doGracefulShutdown();
  } catch (final Exception e) {
   LOGGER.error("Failed doing a graceful shutdown : {}", e.getMessage(), e);
  } finally {
   running = false;
   LOGGER.info("Hook stopped.");
  }
 }
}

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

@Test
@RedisAvailable
public void testRedisPublishingMessageHandler() throws Exception {
  int numToTest = 10;
  String topic = "si.test.channel";
  final CountDownLatch latch = new CountDownLatch(numToTest * 2);
  RedisConnectionFactory connectionFactory = this.getConnectionFactoryForTest();
  MessageListenerAdapter listener = new MessageListenerAdapter();
  listener.setDelegate(new Listener(latch));
  listener.setSerializer(new StringRedisSerializer());
  listener.afterPropertiesSet();
  RedisMessageListenerContainer container = new RedisMessageListenerContainer();
  container.setConnectionFactory(connectionFactory);
  container.afterPropertiesSet();
  container.addMessageListener(listener, Collections.<Topic>singletonList(new ChannelTopic(topic)));
  container.start();
  this.awaitContainerSubscribed(container);
  final RedisPublishingMessageHandler handler = new RedisPublishingMessageHandler(connectionFactory);
  handler.setTopicExpression(new LiteralExpression(topic));
  for (int i = 0; i < numToTest; i++) {
    handler.handleMessage(MessageBuilder.withPayload("test-" + i).build());
  }
  for (int i = 0; i < numToTest; i++) {
    handler.handleMessage(MessageBuilder.withPayload(("test-" + i).getBytes()).build());
  }
  assertTrue(latch.await(10, TimeUnit.SECONDS));
  container.stop();
}

相关文章

微信公众号

最新文章

更多