コード例 #1
0
  @Override
  public List<PagingStore> reloadStores(
      final HierarchicalRepository<AddressSettings> addressSettingsRepository) throws Exception {
    File[] files = directory.listFiles();

    if (files == null) {
      return Collections.<PagingStore>emptyList();
    } else {
      ArrayList<PagingStore> storesReturn = new ArrayList<>(files.length);

      for (File file : files) {

        final String guid = file.getName();

        final File addressFile = new File(file, PagingStoreFactoryNIO.ADDRESS_FILE);

        if (!addressFile.exists()) {
          ActiveMQServerLogger.LOGGER.pageStoreFactoryNoIdFile(
              file.toString(), PagingStoreFactoryNIO.ADDRESS_FILE);
          continue;
        }

        BufferedReader reader =
            new BufferedReader(new InputStreamReader(new FileInputStream(addressFile)));

        String addressString;

        try {
          addressString = reader.readLine();
        } finally {
          reader.close();
        }

        SimpleString address = new SimpleString(addressString);

        SequentialFileFactory factory = newFileFactory(guid);

        AddressSettings settings = addressSettingsRepository.getMatch(address.toString());

        PagingStore store =
            new PagingStoreImpl(
                address,
                scheduledExecutor,
                syncTimeout,
                pagingManager,
                storageManager,
                factory,
                this,
                address,
                settings,
                executorFactory.getExecutor(),
                syncNonTransactional);

        storesReturn.add(store);
      }

      return storesReturn;
    }
  }
コード例 #2
0
  @Override
  public synchronized PagingStore newStore(
      final SimpleString address, final AddressSettings settings) {

    return new PagingStoreImpl(
        address,
        scheduledExecutor,
        syncTimeout,
        pagingManager,
        storageManager,
        null,
        this,
        address,
        settings,
        executorFactory.getExecutor(),
        syncNonTransactional);
  }