1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.hadoop.hbase.zookeeper;
19
20 import java.io.IOException;
21
22 import org.apache.zookeeper.KeeperException;
23 import org.apache.zookeeper.Watcher;
24 import org.apache.zookeeper.ZooKeeper;
25 import org.slf4j.Logger;
26 import org.slf4j.LoggerFactory;
27
28 public class AuthFailingRecoverableZooKeeper extends RecoverableZooKeeper {
29 private static final Logger LOG = LoggerFactory.getLogger(AuthFailingRecoverableZooKeeper.class);
30 private Watcher watcher;
31 private int sessionTimeout;
32 private String quorumServers;
33
34 public AuthFailingRecoverableZooKeeper(String quorumServers, int sessionTimeout, Watcher watcher,
35 int maxRetries, int retryIntervalMillis, int maxSleepTime, String identifier,
36 int authFailedRetries, int authFailedPause, int multiMaxSize) throws IOException {
37 super(quorumServers, sessionTimeout, watcher, maxRetries, retryIntervalMillis, maxSleepTime,
38 identifier, authFailedRetries, authFailedPause, multiMaxSize);
39 this.quorumServers = quorumServers;
40 this.sessionTimeout = sessionTimeout;
41 this.watcher = watcher;
42 }
43
44 @Override
45 ZooKeeper createNewZooKeeper() throws KeeperException {
46 try {
47
48 return new AuthFailingZooKeeper(quorumServers, sessionTimeout, watcher);
49 } catch (IOException ex) {
50 LOG.warn("Unable to create ZooKeeper Connection", ex);
51 throw new KeeperException.OperationTimeoutException();
52 }
53 }
54 }