#vulnerable code 
                             public ZooKeeper getClient(){
		if (zooKeeper==null) {
			try {
				if (INSTANCE_INIT_LOCK.tryLock(2, TimeUnit.SECONDS)) {
					if (zooKeeper==null) {		// 二次校验，防止并发创建client
						try {
							zooKeeper = new ZooKeeper(zkaddress, 10000, watcher);		// TODO，本地变量方式，成功才会赋值
							if (zkdigest!=null && zkdigest.trim().length()>0) {
								zooKeeper.addAuthInfo("digest",zkdigest.getBytes());		// like "account:password"
							}

							zooKeeper.exists(zkpath, false);	// sync
						} catch (Exception e) {
							logger.error(e.getMessage(), e);
						} finally {
							INSTANCE_INIT_LOCK.unlock();
						}
						logger.info(">>>>>>>>>> xxl-rpc, XxlZkClient init success.");
					}
				}
			} catch (InterruptedException e) {
				logger.error(e.getMessage(), e);
			}
		}
		if (zooKeeper == null) {
			throw new XxlRpcException("XxlZkClient.zooKeeper is null.");
		}
		return zooKeeper;
	} 
                            #location 2 
                            #vulnerability type THREAD_SAFETY_VIOLATION
#fixed code
                             public ZooKeeper getClient(){
		if (zooKeeper==null) {
			try {
				if (INSTANCE_INIT_LOCK.tryLock(2, TimeUnit.SECONDS)) {
					if (zooKeeper==null) {		// 二次校验，防止并发创建client

						// init new-client
						ZooKeeper newZk = null;
						try {
							newZk = new ZooKeeper(zkaddress, 10000, watcher);
							if (zkdigest!=null && zkdigest.trim().length()>0) {
								newZk.addAuthInfo("digest",zkdigest.getBytes());		// like "account:password"
							}
							newZk.exists(zkpath, false);		// sync wait until succcess conn

							// set success new-client
							zooKeeper = newZk;
							logger.info(">>>>>>>>>> xxl-rpc, XxlZkClient init success.");
						} catch (Exception e) {
							// close fail new-client
							if (newZk != null) {
								newZk.close();
							}

							logger.error(e.getMessage(), e);
						} finally {
							INSTANCE_INIT_LOCK.unlock();
						}

					}
				}
			} catch (InterruptedException e) {
				logger.error(e.getMessage(), e);
			}
		}
		if (zooKeeper == null) {
			throw new XxlRpcException("XxlZkClient.zooKeeper is null.");
		}
		return zooKeeper;
	}