@Test void nextUidShouldGenerateUniqueValuesWhenParallelCalls() throws ExecutionException, InterruptedException { int threadCount = 10; int nbEntries = 100; ConcurrentSkipListSet<MessageUid> messageUids = new ConcurrentSkipListSet<>(); ConcurrentTestRunner.builder() .operation((threadNumber, step) -> messageUids.add(uidProvider.nextUid(mailbox))) .threadCount(threadCount) .operationCount(nbEntries / threadCount) .runSuccessfullyWithin(Duration.ofMinutes(1)); assertThat(messageUids).hasSize(nbEntries); }
@Override public MessageUid nextUid(Mailbox mailbox) throws MailboxException { return nextUid(mailbox.getMailboxId()); }
CassandraUidProvider implements UidProvider { @Override public MessageUid nextUid(Mailbox mailbox) throws MailboxException { return nextUid(mailbox.getMailboxId()); } }
CassandraUidProvider implements UidProvider { @Override public MessageUid nextUid(Mailbox mailbox) throws MailboxException { return nextUid(mailbox.getMailboxId()); } @Inject  CassandraUidProvider(Session session, CassandraConfiguration cassandraConfiguration,
                                CassandraConsistenciesConfiguration consistenciesConfiguration); }
CassandraUidProvider implements UidProvider { @Override public MessageUid nextUid(Mailbox mailbox) throws MailboxException { return nextUid(mailbox.getMailboxId()); } @Inject  CassandraUidProvider(Session session, CassandraConfiguration cassandraConfiguration,
                                CassandraConsistenciesConfiguration consistenciesConfiguration); @Override MessageUid nextUid(Mailbox mailbox); @Override MessageUid nextUid(MailboxId mailboxId); Mono<MessageUid> nextUid(CassandraId cassandraId); @Override Optional<MessageUid> lastUid(Mailbox mailbox); }
CassandraUidProvider implements UidProvider { @Override public MessageUid nextUid(Mailbox mailbox) throws MailboxException { return nextUid(mailbox.getMailboxId()); } @Inject  CassandraUidProvider(Session session, CassandraConfiguration cassandraConfiguration,
                                CassandraConsistenciesConfiguration consistenciesConfiguration); @Override MessageUid nextUid(Mailbox mailbox); @Override MessageUid nextUid(MailboxId mailboxId); Mono<MessageUid> nextUid(CassandraId cassandraId); @Override Optional<MessageUid> lastUid(Mailbox mailbox);  }