# distributed-lock-project **Repository Path**: i-smart/distributed-lock-project ## Basic Information - **Project Name**: distributed-lock-project - **Description**: 基于zookeeper实现的分布式锁 - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 11 - **Created**: 2019-07-09 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README #distributed-lock-project 基于zookeeper实现的分布式锁,示例如下: ``` DefaultZkLockConfig config = new DefaultZkLockConfig(); config.setZkServers("192.168.137.179:2181"); config.setBasePath("/lock/"); ZkDistributedLock lock = new ZkDistributedLock(config,"test"); lock.lock(); try{ //这里放业务代码; }catch(Exception ex){ //异常处理 }finally{ lock.unlock(); } ```