/** * Read the resources properties file and create {@link XAResourceProducer} accordingly. * @param propertiesFilename the name of the properties file to load. * @return the number of resources which failed to initialize. */ private int init(String propertiesFilename) { try { FileInputStream fis = null; Properties properties; try { fis = new FileInputStream(propertiesFilename); properties = new Properties(); properties.load(fis); } finally { if (fis != null) fis.close(); } return initXAResourceProducers(properties); } catch (IOException ex) { throw new InitializationException("cannot create resource loader", ex); } }
/** * Read the resources properties file and create {@link XAResourceProducer} accordingly. * @param propertiesFilename the name of the properties file to load. * @return the number of resources which failed to initialize. */ private int init(String propertiesFilename) { try { FileInputStream fis = null; Properties properties; try { fis = new FileInputStream(propertiesFilename); properties = new Properties(); properties.load(fis); } finally { if (fis != null) fis.close(); } return initXAResourceProducers(properties); } catch (IOException ex) { throw new InitializationException("cannot create resource loader", ex); } }
/** * Read the resources properties file and create {@link XAResourceProducer} accordingly. * @param propertiesFilename the name of the properties file to load. * @return the number of resources which failed to initialize. */ private int init(String propertiesFilename) { try { FileInputStream fis = null; Properties properties; try { fis = new FileInputStream(propertiesFilename); properties = new Properties(); properties.load(fis); } finally { if (fis != null) fis.close(); } return initXAResourceProducers(properties); } catch (IOException ex) { throw new InitializationException("cannot create resource loader", ex); } }
/** * Read the resources properties file and create {@link XAResourceProducer} accordingly. * @param propertiesFilename the name of the properties file to load. * @return the number of resources which failed to initialize. */ private int init(String propertiesFilename) { try { FileInputStream fis = null; Properties properties; try { fis = new FileInputStream(propertiesFilename); properties = new Properties(); properties.load(fis); } finally { if (fis != null) fis.close(); } return initXAResourceProducers(properties); } catch (IOException ex) { throw new InitializationException("cannot create resource loader", ex); } }
cfgFile = new File(btmPropFile); if (!cfgFile.exists()) { throw new InitializationException("Configuration file not found: " + btmPropFile); resourceFile = new File(resourcePropFile); if (!resourceFile.exists()) { throw new InitializationException("Configuration file not found: " + resourcePropFile);
/** * Create the transactions journal. * @return the transactions journal. */ public static Journal getJournal() { Journal journal = journalRef.get(); if (journal == null) { String configuredJournal = getConfiguration().getJournal(); if ("null".equals(configuredJournal) || null == configuredJournal) { journal = new NullJournal(); } else if ("disk".equals(configuredJournal)) { journal = new DiskJournal(); } else { try { Class clazz = ClassLoaderUtils.loadClass(configuredJournal); journal = (Journal) clazz.newInstance(); } catch (Exception ex) { throw new InitializationException("invalid journal implementation '" + configuredJournal + "'", ex); } } if (log.isDebugEnabled()) log.debug("using journal " + configuredJournal); if (!journalRef.compareAndSet(null, journal)) { journal = journalRef.get(); } } return journal; }
cfgFile = new File(btmPropFile); if (!cfgFile.exists()) { throw new InitializationException("Configuration file not found: " + btmPropFile); resourceFile = new File(resourcePropFile); if (!resourceFile.exists()) { throw new InitializationException("Configuration file not found: " + resourcePropFile);
/** * Create the transactions journal. * @return the transactions journal. */ public static Journal getJournal() { Journal journal = journalRef.get(); if (journal == null) { String configuredJournal = getConfiguration().getJournal(); if ("null".equals(configuredJournal) || null == configuredJournal) { journal = new NullJournal(); } else if ("disk".equals(configuredJournal)) { journal = new DiskJournal(); } else { try { Class<?> clazz = ClassLoaderUtils.loadClass(configuredJournal); journal = (Journal) clazz.newInstance(); } catch (Exception ex) { throw new InitializationException("invalid journal implementation '" + configuredJournal + "'", ex); } } if (log.isDebugEnabled()) { log.debug("using journal " + configuredJournal); } if (!journalRef.compareAndSet(null, journal)) { journal = journalRef.get(); } } return journal; }
/** * Create the transactions journal. * @return the transactions journal. */ public static Journal getJournal() { Journal journal = journalRef.get(); if (journal == null) { String configuredJournal = getConfiguration().getJournal(); if ("null".equals(configuredJournal) || null == configuredJournal) { journal = new NullJournal(); } else if ("disk".equals(configuredJournal)) { journal = new DiskJournal(); } else { try { Class clazz = ClassLoaderUtils.loadClass(configuredJournal); journal = (Journal) clazz.newInstance(); } catch (Exception ex) { throw new InitializationException("invalid journal implementation '" + configuredJournal + "'", ex); } } if (log.isDebugEnabled()) log.debug("using journal " + configuredJournal); if (!journalRef.compareAndSet(null, journal)) { journal = journalRef.get(); } } return journal; }
/** * Create the transactions journal. * @return the transactions journal. */ public static Journal getJournal() { Journal journal = journalRef.get(); if (journal == null) { String configuredJournal = getConfiguration().getJournal(); if ("null".equals(configuredJournal) || null == configuredJournal) { journal = new NullJournal(); } else if ("disk".equals(configuredJournal)) { journal = new DiskJournal(); } else { try { Class<?> clazz = ClassLoaderUtils.loadClass(configuredJournal); journal = (Journal) clazz.newInstance(); } catch (Exception ex) { throw new InitializationException("invalid journal implementation '" + configuredJournal + "'", ex); } } if (log.isDebugEnabled()) { log.debug("using journal " + configuredJournal); } if (!journalRef.compareAndSet(null, journal)) { journal = journalRef.get(); } } return journal; }
/** * Create the {@link BitronixTransactionManager}. Open the journal, load resources and perform recovery * synchronously. The recovery service then gets scheduled for background recovery. */ public BitronixTransactionManager() { try { shuttingDown = false; logVersion(); Configuration configuration = TransactionManagerServices.getConfiguration(); configuration.buildServerIdArray(); // first call will initialize the ServerId if (log.isDebugEnabled()) log.debug("starting BitronixTransactionManager using " + configuration); TransactionManagerServices.getJournal().open(); TransactionManagerServices.getResourceLoader().init(); TransactionManagerServices.getRecoverer().run(); int backgroundRecoveryInterval = TransactionManagerServices.getConfiguration().getBackgroundRecoveryIntervalSeconds(); if (backgroundRecoveryInterval < 1) { throw new InitializationException("invalid configuration value for backgroundRecoveryIntervalSeconds, found '" + backgroundRecoveryInterval + "' but it must be greater than 0"); } if (log.isDebugEnabled()) log.debug("recovery will run in the background every " + backgroundRecoveryInterval + " second(s)"); Date nextExecutionDate = new Date(MonotonicClock.currentTimeMillis() + (backgroundRecoveryInterval * 1000L)); TransactionManagerServices.getTaskScheduler().scheduleRecovery(TransactionManagerServices.getRecoverer(), nextExecutionDate); } catch (IOException ex) { throw new InitializationException("cannot open disk journal", ex); } catch (Exception ex) { TransactionManagerServices.getJournal().shutdown(); TransactionManagerServices.getResourceLoader().shutdown(); throw new InitializationException("initialization failed, cannot safely start the transaction manager", ex); } }
/** * Create the {@link BitronixTransactionManager}. Open the journal, load resources and perform recovery * synchronously. The recovery service then gets scheduled for background recovery. */ public BitronixTransactionManager() { try { shuttingDown = false; logVersion(); Configuration configuration = TransactionManagerServices.getConfiguration(); configuration.buildServerIdArray(); // first call will initialize the ServerId if (log.isDebugEnabled()) { log.debug("starting BitronixTransactionManager using " + configuration); } TransactionManagerServices.getJournal().open(); TransactionManagerServices.getResourceLoader().init(); TransactionManagerServices.getRecoverer().run(); int backgroundRecoveryInterval = TransactionManagerServices.getConfiguration().getBackgroundRecoveryIntervalSeconds(); if (backgroundRecoveryInterval < 1) { throw new InitializationException("invalid configuration value for backgroundRecoveryIntervalSeconds, found '" + backgroundRecoveryInterval + "' but it must be greater than 0"); } inFlightTransactions = createInFlightTransactionsMap(); if (log.isDebugEnabled()) { log.debug("recovery will run in the background every " + backgroundRecoveryInterval + " second(s)"); } Date nextExecutionDate = new Date(MonotonicClock.currentTimeMillis() + (backgroundRecoveryInterval * 1000L)); TransactionManagerServices.getTaskScheduler().scheduleRecovery(TransactionManagerServices.getRecoverer(), nextExecutionDate); } catch (IOException ex) { throw new InitializationException("cannot open disk journal", ex); } catch (Exception ex) { TransactionManagerServices.getJournal().shutdown(); TransactionManagerServices.getResourceLoader().shutdown(); throw new InitializationException("initialization failed, cannot safely start the transaction manager", ex); } }
/** * Create the {@link BitronixTransactionManager}. Open the journal, load resources and perform recovery * synchronously. The recovery service then gets scheduled for background recovery. */ public BitronixTransactionManager() { try { shuttingDown = false; logVersion(); Configuration configuration = TransactionManagerServices.getConfiguration(); configuration.buildServerIdArray(); // first call will initialize the ServerId if (log.isDebugEnabled()) { log.debug("starting BitronixTransactionManager using " + configuration); } TransactionManagerServices.getJournal().open(); TransactionManagerServices.getResourceLoader().init(); TransactionManagerServices.getRecoverer().run(); int backgroundRecoveryInterval = TransactionManagerServices.getConfiguration().getBackgroundRecoveryIntervalSeconds(); if (backgroundRecoveryInterval < 1) { throw new InitializationException("invalid configuration value for backgroundRecoveryIntervalSeconds, found '" + backgroundRecoveryInterval + "' but it must be greater than 0"); } inFlightTransactions = createInFlightTransactionsMap(); if (log.isDebugEnabled()) { log.debug("recovery will run in the background every " + backgroundRecoveryInterval + " second(s)"); } Date nextExecutionDate = new Date(MonotonicClock.currentTimeMillis() + (backgroundRecoveryInterval * 1000L)); TransactionManagerServices.getTaskScheduler().scheduleRecovery(TransactionManagerServices.getRecoverer(), nextExecutionDate); } catch (IOException ex) { throw new InitializationException("cannot open disk journal", ex); } catch (Exception ex) { TransactionManagerServices.getJournal().shutdown(); TransactionManagerServices.getResourceLoader().shutdown(); throw new InitializationException("initialization failed, cannot safely start the transaction manager", ex); } }
/** * Create the {@link BitronixTransactionManager}. Open the journal, load resources and perform recovery * synchronously. The recovery service then gets scheduled for background recovery. */ public BitronixTransactionManager() { try { shuttingDown = false; logVersion(); Configuration configuration = TransactionManagerServices.getConfiguration(); configuration.buildServerIdArray(); // first call will initialize the ServerId if (log.isDebugEnabled()) log.debug("starting BitronixTransactionManager using " + configuration); TransactionManagerServices.getJournal().open(); TransactionManagerServices.getResourceLoader().init(); TransactionManagerServices.getRecoverer().run(); int backgroundRecoveryInterval = TransactionManagerServices.getConfiguration().getBackgroundRecoveryIntervalSeconds(); if (backgroundRecoveryInterval < 1) { throw new InitializationException("invalid configuration value for backgroundRecoveryIntervalSeconds, found '" + backgroundRecoveryInterval + "' but it must be greater than 0"); } if (log.isDebugEnabled()) log.debug("recovery will run in the background every " + backgroundRecoveryInterval + " second(s)"); Date nextExecutionDate = new Date(MonotonicClock.currentTimeMillis() + (backgroundRecoveryInterval * 1000L)); TransactionManagerServices.getTaskScheduler().scheduleRecovery(TransactionManagerServices.getRecoverer(), nextExecutionDate); } catch (IOException ex) { throw new InitializationException("cannot open disk journal", ex); } catch (Exception ex) { TransactionManagerServices.getJournal().shutdown(); TransactionManagerServices.getResourceLoader().shutdown(); throw new InitializationException("initialization failed, cannot safely start the transaction manager", ex); } }
resourceConfigurationFilename = getString(properties, "bitronix.tm.resource.configuration", null); } catch (IOException ex) { throw new InitializationException("error loading configuration", ex);
resourceConfigurationFilename = getString(properties, "bitronix.tm.resource.configuration", null); } catch (IOException ex) { throw new InitializationException("error loading configuration", ex);
jdbcProxyFactoryClass = getString(properties, "bitronix.tm.jdbcProxyFactoryClass", "auto"); } catch (IOException ex) { throw new InitializationException("error loading configuration", ex);
jdbcProxyFactoryClass = getString(properties, "bitronix.tm.jdbcProxyFactoryClass", "auto"); } catch (IOException ex) { throw new InitializationException("error loading configuration", ex);