示例#1
0
  /**
   * {@inheritDoc}
   *
   * @see org.jboss.msc.service.Service#stop(org.jboss.msc.service.StopContext)
   */
  @Override
  public void stop(StopContext context) {
    EmbeddedCacheManager container = this.dependencies.getCacheContainer();
    XAResourceRecoveryRegistry recoveryRegistry = this.dependencies.getRecoveryRegistry();
    if (recoveryRegistry != null) {
      recoveryRegistry.addXAResourceRecovery(
          new InfinispanXAResourceRecovery(this.name, container));
    }

    this.cache.stop();

    this.cache = null;
  }
示例#2
0
  /**
   * {@inheritDoc}
   *
   * @see org.jboss.msc.service.Service#start(org.jboss.msc.service.StartContext)
   */
  @Override
  public void start(StartContext context) throws StartException {

    EmbeddedCacheManager container = this.dependencies.getCacheContainer();

    // get an instance of the defined cache
    this.cache = container.getCache(this.name);
    this.cache.start();

    XAResourceRecoveryRegistry recoveryRegistry = this.dependencies.getRecoveryRegistry();
    if (recoveryRegistry != null) {
      recoveryRegistry.addXAResourceRecovery(
          new InfinispanXAResourceRecovery(this.name, container));
    }
  }