Ejemplo n.º 1
0
 /**
  * Waits for backup to be in the "started" state and to finish synchronization with its live.
  *
  * @param sessionFactory
  * @param seconds
  * @throws Exception
  */
 protected void waitForBackup(ClientSessionFactoryInternal sessionFactory, int seconds)
     throws Exception {
   final ActiveMQServerImpl actualServer = (ActiveMQServerImpl) backupServer.getServer();
   if (actualServer.getHAPolicy().isSharedStore()) {
     waitForServerToStart(actualServer);
   } else {
     waitForRemoteBackup(sessionFactory, seconds, true, actualServer);
   }
 }
  @Override
  public synchronized void start() throws Exception {
    Configuration config = server.getConfiguration();
    try {
      storageManager = server.getStorageManager();
      storageManager.start();

      server.getManagementService().setStorageManager(storageManager);

      journalsHolder.put(JournalContent.BINDINGS, storageManager.getBindingsJournal());
      journalsHolder.put(JournalContent.MESSAGES, storageManager.getMessageJournal());

      for (JournalContent jc : EnumSet.allOf(JournalContent.class)) {
        filesReservedForSync.put(jc, new HashMap<Long, JournalSyncFile>());
        // We only need to load internal structures on the backup...
        journalLoadInformation[jc.typeByte] =
            journalsHolder.get(jc).loadSyncOnly(JournalState.SYNCING);
      }

      pageManager =
          new PagingManagerImpl(
              new PagingStoreFactoryNIO(
                  storageManager,
                  config.getPagingLocation(),
                  config.getJournalBufferSize_NIO(),
                  server.getScheduledPool(),
                  server.getExecutorFactory(),
                  config.isJournalSyncNonTransactional(),
                  criticalErrorListener),
              server.getAddressSettingsRepository());

      pageManager.start();

      started = true;
    } catch (Exception e) {
      if (server.isStarted()) throw e;
    }
  }
 /** @param packet */
 private void handleFatalError(BackupReplicationStartFailedMessage packet) {
   ActiveMQServerLogger.LOGGER.errorStartingReplication(packet.getRegistrationProblem());
   server.stopTheServer(false);
 }