This project has retired. For details please refer to its Attic page.
ZookeeperConfig xref
View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  package org.apache.giraph.zk;
19  
20  import java.net.InetSocketAddress;
21  
22  /**
23   * Zookeeper configuration file.
24   * Originally copied from zookeeper sources to allow
25   * modification on the fly instead of reading from disk.
26   */
27  public class ZookeeperConfig {
28  
29    /** Zookeeper server address */
30    private InetSocketAddress clientPortAddress;
31    /** Snapshot log dir */
32    private String dataDir;
33    /** Transaction log dir */
34    private String dataLogDir;
35    /** minimum session timeout in milliseconds */
36    private int minSessionTimeout = -1;
37    /** maximum session timeout in milliseconds */
38    private int maxSessionTimeout = -1;
39    /**
40     * Get zookeeper server address
41     * @return zookeeper server address
42     */
43    public InetSocketAddress getClientPortAddress() { return clientPortAddress; }
44  
45    /**
46     * Snapshot dir
47     * @return snapshot dir path
48     */
49    public String getDataDir() { return dataDir; }
50  
51    /**
52     * Transaction dir
53     * @return transaction dir path
54     */
55    public String getDataLogDir() {
56      if (dataLogDir == null) {
57        return dataDir;
58      }
59      return dataLogDir;
60    }
61    /**
62     * Minimum session timeout in milliseconds.
63     * @return Minimum session time.
64     */
65    public int getMinSessionTimeout() { return minSessionTimeout; }
66  
67    /**
68     * Maximum session timeout in milliseconds.
69     *
70     * @return Maximum session time.
71     */
72    public int getMaxSessionTimeout() { return maxSessionTimeout; }
73  
74    /**
75     * Set snapshot log dir
76     * @param dataDir snapshot log dir path
77     */
78    public void setDataDir(String dataDir) {
79      this.dataDir = dataDir;
80    }
81  
82    /**
83     * Transaction log dir
84     * @param dataLogDir transaction log dir path
85     */
86    public void setDataLogDir(String dataLogDir) {
87      this.dataLogDir = dataLogDir;
88    }
89  
90    /**
91     * Set zookeeper server address
92     * @param clientPortAddress server address
93     */
94    public void setClientPortAddress(InetSocketAddress clientPortAddress) {
95      this.clientPortAddress = clientPortAddress;
96    }
97  
98    /**
99     * Set minimum session timeout in milliseconds
100    * @param minSessionTimeout min session timeout
101    */
102   public void setMinSessionTimeout(int minSessionTimeout) {
103     this.minSessionTimeout = minSessionTimeout;
104   }
105   /**
106    * Set maximum session timeout in milliseconds
107    * @param maxSessionTimeout max session timeout
108    */
109   public void setMaxSessionTimeout(int maxSessionTimeout) {
110     this.maxSessionTimeout = maxSessionTimeout;
111   }
112 
113 }