View Javadoc

1   /*
2    *
3    * Licensed to the Apache Software Foundation (ASF) under one
4    * or more contributor license agreements.  See the NOTICE file
5    * distributed with this work for additional information
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  You may obtain a copy of the License at
10   *
11   *     http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   */
19  package org.apache.hadoop.hbase.replication;
20  
21  import org.apache.hadoop.hbase.classification.InterfaceAudience;
22  import org.apache.hadoop.conf.Configuration;
23  import org.apache.hadoop.hbase.Abortable;
24  import org.apache.hadoop.hbase.HBaseInterfaceAudience;
25  import org.apache.hadoop.hbase.Stoppable;
26  import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher;
27  
28  /**
29   * A factory class for instantiating replication objects that deal with replication state.
30   */
31  @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.REPLICATION)
32  public class ReplicationFactory {
33  
34    public static ReplicationQueues getReplicationQueues(final ZooKeeperWatcher zk,
35        Configuration conf, Abortable abortable) {
36      return new ReplicationQueuesZKImpl(zk, conf, abortable);
37    }
38  
39    public static ReplicationQueuesClient getReplicationQueuesClient(final ZooKeeperWatcher zk,
40        Configuration conf, Abortable abortable) {
41      return new ReplicationQueuesClientZKImpl(zk, conf, abortable);
42    }
43  
44    public static ReplicationPeers getReplicationPeers(final ZooKeeperWatcher zk, Configuration conf,
45        Abortable abortable) {
46      return new ReplicationPeersZKImpl(zk, conf, abortable);
47    }
48  
49    public static ReplicationTracker getReplicationTracker(ZooKeeperWatcher zookeeper,
50        final ReplicationPeers replicationPeers, Configuration conf, Abortable abortable,
51        Stoppable stopper) {
52      return new ReplicationTrackerZKImpl(zookeeper, replicationPeers, conf, abortable, stopper);
53    }
54  }