You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tephra.apache.org by po...@apache.org on 2016/09/09 04:42:13 UTC
incubator-tephra git commit: Make TransactionManager Singleton for
in-memory and local bindings.
Repository: incubator-tephra
Updated Branches:
refs/heads/master b1220ce67 -> b9eae01f3
Make TransactionManager Singleton for in-memory and local bindings.
This closes #7
Signed-off-by: poorna <po...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/incubator-tephra/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tephra/commit/b9eae01f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tephra/tree/b9eae01f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tephra/diff/b9eae01f
Branch: refs/heads/master
Commit: b9eae01f3f92f70cf61646da86234a8acf370a5f
Parents: b1220ce
Author: Ali Anwar <an...@berkeley.edu>
Authored: Thu Sep 8 20:45:15 2016 -0700
Committer: poorna <po...@apache.org>
Committed: Thu Sep 8 21:42:02 2016 -0700
----------------------------------------------------------------------
.../apache/tephra/runtime/TransactionInMemoryModule.java | 9 ++-------
.../org/apache/tephra/runtime/TransactionLocalModule.java | 9 ++++-----
2 files changed, 6 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tephra/blob/b9eae01f/tephra-core/src/main/java/org/apache/tephra/runtime/TransactionInMemoryModule.java
----------------------------------------------------------------------
diff --git a/tephra-core/src/main/java/org/apache/tephra/runtime/TransactionInMemoryModule.java b/tephra-core/src/main/java/org/apache/tephra/runtime/TransactionInMemoryModule.java
index 1b9032c..0c5a3f3 100644
--- a/tephra-core/src/main/java/org/apache/tephra/runtime/TransactionInMemoryModule.java
+++ b/tephra-core/src/main/java/org/apache/tephra/runtime/TransactionInMemoryModule.java
@@ -20,7 +20,6 @@ package org.apache.tephra.runtime;
import com.google.inject.AbstractModule;
import com.google.inject.Scopes;
-import com.google.inject.Singleton;
import com.google.inject.assistedinject.FactoryModuleBuilder;
import org.apache.tephra.DefaultTransactionExecutor;
import org.apache.tephra.TransactionExecutor;
@@ -39,16 +38,12 @@ import org.apache.tephra.snapshot.SnapshotCodecProvider;
* test classes, as the transaction state cannot be recovered in the case of a failure.
*/
public class TransactionInMemoryModule extends AbstractModule {
- public TransactionInMemoryModule() {
- }
@Override
protected void configure() {
- // some of these classes need to be non-singleton in order to create a new instance during leader() in
- // TransactionService
bind(SnapshotCodecProvider.class).in(Scopes.SINGLETON);
- bind(TransactionStateStorage.class).to(NoOpTransactionStateStorage.class);
- bind(TransactionManager.class);
+ bind(TransactionStateStorage.class).to(NoOpTransactionStateStorage.class).in(Scopes.SINGLETON);
+ bind(TransactionManager.class).in(Scopes.SINGLETON);
bind(TransactionSystemClient.class).to(InMemoryTxSystemClient.class).in(Scopes.SINGLETON);
// no metrics output for in-memory
bind(MetricsCollector.class).to(TxMetricsCollector.class);
http://git-wip-us.apache.org/repos/asf/incubator-tephra/blob/b9eae01f/tephra-core/src/main/java/org/apache/tephra/runtime/TransactionLocalModule.java
----------------------------------------------------------------------
diff --git a/tephra-core/src/main/java/org/apache/tephra/runtime/TransactionLocalModule.java b/tephra-core/src/main/java/org/apache/tephra/runtime/TransactionLocalModule.java
index 4a79e8d..0dba09e 100644
--- a/tephra-core/src/main/java/org/apache/tephra/runtime/TransactionLocalModule.java
+++ b/tephra-core/src/main/java/org/apache/tephra/runtime/TransactionLocalModule.java
@@ -19,6 +19,7 @@
package org.apache.tephra.runtime;
import com.google.inject.AbstractModule;
+import com.google.inject.Scopes;
import com.google.inject.Singleton;
import com.google.inject.assistedinject.FactoryModuleBuilder;
import com.google.inject.name.Names;
@@ -41,14 +42,12 @@ final class TransactionLocalModule extends AbstractModule {
@Override
protected void configure() {
- // some of these classes need to be non-singleton in order to create a new instance during leader() in
- // TransactionService
bind(SnapshotCodecProvider.class).in(Singleton.class);
bind(TransactionStateStorage.class).annotatedWith(Names.named("persist"))
- .to(LocalFileTransactionStateStorage.class);
- bind(TransactionStateStorage.class).toProvider(TransactionStateStorageProvider.class);
+ .to(LocalFileTransactionStateStorage.class).in(Scopes.SINGLETON);
+ bind(TransactionStateStorage.class).toProvider(TransactionStateStorageProvider.class).in(Scopes.SINGLETON);
- bind(TransactionManager.class);
+ bind(TransactionManager.class).in(Scopes.SINGLETON);
bind(TransactionSystemClient.class).to(InMemoryTxSystemClient.class).in(Singleton.class);
bind(MetricsCollector.class).to(DefaultMetricsCollector.class);