Пример #1
0
  public void setDeadLetterAddress(final String deadLetterAddress) throws Exception {
    checkStarted();

    clearIO();
    try {
      AddressSettings addressSettings = addressSettingsRepository.getMatch(address);

      if (deadLetterAddress != null) {
        addressSettings.setDeadLetterAddress(new SimpleString(deadLetterAddress));
      }
    } finally {
      blockOnIO();
    }
  }
Пример #2
0
  public String getDeadLetterAddress() {
    checkStarted();

    clearIO();
    try {
      AddressSettings addressSettings = addressSettingsRepository.getMatch(address);

      if (addressSettings != null && addressSettings.getDeadLetterAddress() != null) {
        return addressSettings.getDeadLetterAddress().toString();
      }
      return null;
    } finally {
      blockOnIO();
    }
  }
Пример #3
0
  public void setExpiryAddress(final String expiryAddress) throws Exception {
    checkStarted();

    clearIO();
    try {
      AddressSettings addressSettings = addressSettingsRepository.getMatch(address);

      SimpleString sExpiryAddress = new SimpleString(expiryAddress);

      if (expiryAddress != null) {
        addressSettings.setExpiryAddress(sExpiryAddress);
      }

      queue.setExpiryAddress(sExpiryAddress);
    } finally {
      blockOnIO();
    }
  }
Пример #4
0
  public static void main(final String arg[]) {
    if (arg.length != 2) {
      System.err.println("Usage: PrintPages <page folder> <journal folder>");
      System.exit(-1);
    }
    try {

      PageCursorsInfo cursorACKs = PrintPages.loadCursorACKs(arg[1]);

      Set<Long> pgTXs = cursorACKs.getPgTXs();

      ScheduledExecutorService scheduled = Executors.newScheduledThreadPool(1);
      final ExecutorService executor = Executors.newFixedThreadPool(10);
      ExecutorFactory execfactory =
          new ExecutorFactory() {

            public Executor getExecutor() {
              return executor;
            }
          };
      final StorageManager sm = new NullStorageManager();
      PagingStoreFactory pageStoreFactory =
          new PagingStoreFactoryNIO(sm, arg[0], 1000l, scheduled, execfactory, false, null);
      HierarchicalRepository<AddressSettings> addressSettingsRepository =
          new HierarchicalObjectRepository<AddressSettings>();
      addressSettingsRepository.setDefault(new AddressSettings());
      PagingManager manager = new PagingManagerImpl(pageStoreFactory, addressSettingsRepository);

      manager.start();

      SimpleString stores[] = manager.getStoreNames();

      for (SimpleString store : stores) {
        PagingStore pgStore = manager.getPageStore(store);
        String folder = null;

        if (pgStore != null) {
          folder = pgStore.getFolder();
        }
        System.out.println(
            "####################################################################################################");
        System.out.println("Exploring store " + store + " folder = " + folder);
        int pgid = (int) pgStore.getFirstPage();
        for (int pg = 0; pg < pgStore.getNumberOfPages(); pg++) {
          System.out.println("*******   Page " + pgid);
          Page page = pgStore.createPage(pgid);
          page.open();
          List<PagedMessage> msgs = page.read(sm);
          page.close();

          int msgID = 0;

          for (PagedMessage msg : msgs) {
            msg.initMessage(sm);
            System.out.print(
                "pg="
                    + pgid
                    + ", msg="
                    + msgID
                    + ",pgTX="
                    + msg.getTransactionID()
                    + ",userMessageID="
                    + (msg.getMessage().getUserID() != null ? msg.getMessage().getUserID() : "")
                    + ", msg="
                    + msg.getMessage());
            System.out.print(",Queues = ");
            long q[] = msg.getQueueIDs();
            for (int i = 0; i < q.length; i++) {
              System.out.print(q[i]);

              PagePosition posCheck = new PagePositionImpl(pgid, msgID);

              boolean acked = false;

              Set<PagePosition> positions = cursorACKs.getCursorRecords().get(q[i]);
              if (positions != null) {
                acked = positions.contains(posCheck);
              }

              if (acked) {
                System.out.print(" (ACK)");
              }

              if (cursorACKs.getCompletePages(q[i]).contains(Long.valueOf(pgid))) {
                System.out.println(" (PG-COMPLETE)");
              }

              if (i + 1 < q.length) {
                System.out.print(",");
              }
            }
            if (msg.getTransactionID() >= 0 && !pgTXs.contains(msg.getTransactionID())) {
              System.out.print(", **PG_TX_NOT_FOUND**");
            }
            System.out.println();
            msgID++;
          }

          pgid++;
        }
      }

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Пример #5
0
 private PagingStore newStore(final SimpleString address) throws Exception {
   return pagingStoreFactory.newStore(
       address, addressSettingsRepository.getMatch(address.toString()));
 }