tephra-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From poornachandra <...@git.apache.org>
Subject [GitHub] incubator-tephra pull request #10: TEPHRA-179 Transaction service high avail...
Date Tue, 13 Sep 2016 02:02:06 GMT
Github user poornachandra commented on a diff in the pull request:

    https://github.com/apache/incubator-tephra/pull/10#discussion_r78485992
  
    --- Diff: tephra-core/src/main/java/org/apache/tephra/runtime/DefaultTransactionManagerProvider.java
---
    @@ -0,0 +1,71 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *   http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +
    +package org.apache.tephra.runtime;
    +
    +import com.google.common.annotations.VisibleForTesting;
    +import com.google.inject.AbstractModule;
    +import com.google.inject.Guice;
    +import com.google.inject.Inject;
    +import com.google.inject.Injector;
    +import com.google.inject.Module;
    +import com.google.inject.Provider;
    +import org.apache.hadoop.conf.Configuration;
    +import org.apache.tephra.TransactionManager;
    +import org.apache.twill.zookeeper.ZKClient;
    +import org.apache.twill.zookeeper.ZKClientService;
    +
    +/**
    + * A provider for {@link TransactionManager} that provides a new instance every time.
    + */
    +public class DefaultTransactionManagerProvider implements Provider<TransactionManager>
{
    +  private final Configuration conf;
    +  private final ZKClientService zkClientService;
    +
    +  @Inject
    +  public DefaultTransactionManagerProvider(Configuration conf, ZKClientService zkClientService)
{
    +    this.conf = conf;
    +    this.zkClientService = zkClientService;
    +  }
    +
    +  @Override
    +  public TransactionManager get() {
    +    // Create a new injector every time since Guice services cannot be restarted TEPHRA-179
    +    Injector injector = Guice.createInjector(
    --- End diff --
    
    This will require more decoupling. We'll need to break the class hierarchy into HA Transaction
Service, Transaction Service and Transaction Manager. For now I have added some get methods
to help testing in PR https://github.com/apache/incubator-tephra/pull/11


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message