Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Require executor to be passed to lock refreshing timelock #2466

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 8 additions & 13 deletions atlasdb-config/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@ Creating a `TransactionManager`:
```java
AtlasDbConfig atlasConfig = ...
Schema atlasSchema = ...
Optional<SSLSocketFactory> sslSocketFactory = ...

SerializableTransactionManager tm = TransactionManagers.create(
atlasConfig,
sslSocketFactory,
atlasSchema,
(resource) -> {});
SerializableTransactionManager tm = TransactionManagers.builder()
.config(atlasConfig)
.schemas(ImmutableSet.of(atlasSchema))
.buildSerializable();
```

The last item is a consumer of resources meant to be exposed to as web
Expand Down Expand Up @@ -48,12 +45,10 @@ And initialization code to your run method:

```java
public void run(AtlasDbServerConfiguration config, Environment env) throws Exception {
TransactionManager transactionManager =
TransactionManagers.create(
config.getAtlas(),
Optional.<SSLSocketFactory>absent(),
ImmutableSet.<Schema>of(),
env.jersey()::register);
TransactionManager transactionManager = TransactionManagers.builder()
.config(config.getAtlas())
.env(env.jersey()::register)
.buildSerializable();
...
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.Executors;
import java.util.function.Consumer;

import javax.net.ssl.SSLSocketFactory;

Expand All @@ -36,7 +37,6 @@
import com.google.common.net.HostAndPort;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.palantir.atlasdb.config.LeaderConfig;
import com.palantir.atlasdb.factory.TransactionManagers.Environment;
import com.palantir.atlasdb.http.AtlasDbHttpClients;
import com.palantir.atlasdb.http.NotCurrentLeaderExceptionMapper;
import com.palantir.atlasdb.http.UserAgents;
Expand All @@ -62,22 +62,22 @@ private Leaders() {
* Creates a LeaderElectionService using the supplied configuration and
* registers appropriate endpoints for that service.
*/
public static LeaderElectionService create(Environment env, LeaderConfig config) {
public static LeaderElectionService create(Consumer<Object> env, LeaderConfig config) {
return create(env, config, UserAgents.DEFAULT_USER_AGENT);
}

public static LeaderElectionService create(Environment env, LeaderConfig config, String userAgent) {
public static LeaderElectionService create(Consumer<Object> env, LeaderConfig config, String userAgent) {
return createAndRegisterLocalServices(env, config, userAgent).leaderElectionService();
}

public static LocalPaxosServices createAndRegisterLocalServices(
Environment env, LeaderConfig config, String userAgent) {
Consumer<Object> env, LeaderConfig config, String userAgent) {
LocalPaxosServices localPaxosServices = createInstrumentedLocalServices(config, userAgent);

env.register(localPaxosServices.ourAcceptor());
env.register(localPaxosServices.ourLearner());
env.register(localPaxosServices.pingableLeader());
env.register(new NotCurrentLeaderExceptionMapper());
env.accept(localPaxosServices.ourAcceptor());
env.accept(localPaxosServices.ourLearner());
env.accept(localPaxosServices.pingableLeader());
env.accept(new NotCurrentLeaderExceptionMapper());
return localPaxosServices;
}

Expand Down
Loading