Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source.
   * Copyright 2011, Red Hat, Inc., and individual contributors
   * as indicated by the @author tags. See the copyright.txt file in the
   * distribution for a full listing of individual contributors.
   *
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
 
 package org.jboss.as.txn;
 
 import  com.arjuna.ats.jbossatx.jta.RecoveryManagerService;
 import java.util.List;
 import static org.jboss.as.txn.SecurityActions.setContextLoader;
A service responsible for exposing the propriatary Arjuna RecoveryManagerService.

Author(s):
John Bailey
 
 public class ArjunaRecoveryManagerService implements Service<RecoveryManagerService> {
 
 
     private final InjectedValue<ORBorbInjector = new InjectedValue<ORB>();
 
     private RecoveryManagerService recoveryManagerService;
 
     public synchronized void start(StartContext contextthrows StartException {
         final ORB orb = .getValue();
 
         // JTS expects the TCCL to be set to something that can find the log factory class.
         try {
             // Recovery env bean
             final RecoveryEnvironmentBean recoveryEnvironmentBean = recoveryPropertyManager.getRecoveryEnvironmentBean();
             final SocketBinding recoveryBinding = .getValue();
             recoveryEnvironmentBean.setRecoveryInetAddress(recoveryBinding.getSocketAddress().getAddress());
             recoveryEnvironmentBean.setRecoveryPort(recoveryBinding.getSocketAddress().getPort());
             final SocketBinding statusBinding = .getValue();
             recoveryEnvironmentBean.setTransactionStatusManagerInetAddress(statusBinding.getSocketAddress().getAddress());
             recoveryEnvironmentBean.setTransactionStatusManagerPort(statusBinding.getSocketAddress().getPort());
 
             final List<StringrecoveryExtensions = new ArrayList<String>();
             recoveryExtensions.add(AtomicActionRecoveryModule.class.getName());
             recoveryExtensions.add(TORecoveryModule.class.getName());
 
             final List<StringexpiryScanners = new ArrayList<String>();
             expiryScanners.add(ExpiredTransactionStatusManagerScanner.class.getName());
 
 
             if (orb == null) {
                 recoveryExtensions.add(com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.class.getName());
                 recoveryEnvironmentBean.setRecoveryExtensions(recoveryExtensions);
                 recoveryEnvironmentBean.setExpiryScanners(expiryScanners);
                 recoveryEnvironmentBean.setRecoveryActivators(null);
 
                 final RecoveryManagerService recoveryManagerService = new RecoveryManagerService();
                 try {
                     recoveryManagerService.create();
                 } catch (Exception e) {
                     throw new StartException("Recovery manager create failed"e);
                 }
                recoveryManagerService.start();
                this. = recoveryManagerService;
            } else {
                recoveryExtensions.add(TopLevelTransactionRecoveryModule.class.getName());
                recoveryExtensions.add(ServerTransactionRecoveryModule.class.getName());
                recoveryExtensions.add(com.arjuna.ats.internal.jta.recovery.jts.XARecoveryModule.class.getName());
                expiryScanners.add(ExpiredContactScanner.class.getName());
                expiryScanners.add(ExpiredToplevelScanner.class.getName());
                expiryScanners.add(ExpiredServerScanner.class.getName());
                recoveryEnvironmentBean.setRecoveryExtensions(recoveryExtensions);
                recoveryEnvironmentBean.setExpiryScanners(expiryScanners);
                recoveryEnvironmentBean.setRecoveryActivators(Collections.singletonList(com.arjuna.ats.internal.jts.orbspecific.recovery.RecoveryEnablement.class.getName()));
                try {
                    final RecoveryManagerService recoveryManagerService = new com.arjuna.ats.jbossatx.jts.RecoveryManagerService(orb);
                    recoveryManagerService.create();
                    recoveryManagerService.start();
                    this. = recoveryManagerService;
                } catch (Exception e) {
                    throw new StartException("Recovery manager create failed"e);
                }
            }
        } finally {
            setContextLoader(null);
        }
    }
    public synchronized void stop(StopContext context) {
        try {
            .stop();
        } catch (Exception e) {
            // todo log
        }
        .destroy();
         = null;
    }
    public synchronized RecoveryManagerService getValue() throws IllegalStateExceptionIllegalArgumentException {
        return ;
    }
        return ;
    }
        return ;
    }
        return ;
    }
New to GrepCode? Check out our FAQ X