### Question:
ZKSessionLock implements SessionLock { static boolean areLockWaitersInSameSession(String node1, String node2) { String[] parts1 = node1.split("_"); String[] parts2 = node2.split("_"); if (parts1.length != 4 || parts2.length != 4) { return node1.equals(node2); } if (!parts1[2].startsWith("s") || !parts2[2].startsWith("s")) { return node1.equals(node2); } long sessionOwner1 = Long.parseLong(parts1[2].substring(1)); long sessionOwner2 = Long.parseLong(parts2[2].substring(1)); if (sessionOwner1 != sessionOwner2) { return false; } String clientId1, clientId2; try { clientId1 = URLDecoder.decode(parts1[1], UTF_8.name()); clientId2 = URLDecoder.decode(parts2[1], UTF_8.name()); return clientId1.equals(clientId2); } catch (UnsupportedEncodingException e) { return node1.equals(node2); } } ZKSessionLock(ZooKeeperClient zkClient,
                  String lockPath,
                  String clientId,
                  OrderedScheduler lockStateExecutor);  ZKSessionLock(ZooKeeperClient zkClient,
                         String lockPath,
                         String clientId,
                         OrderedScheduler lockStateExecutor,
                         long lockOpTimeout,
                         StatsLogger statsLogger,
                         DistributedLockContext lockContext); static String getLockPathPrefixV1(String lockPath); static String getLockPathPrefixV2(String lockPath, String clientId); static String getLockPathPrefixV3(String lockPath, String clientId, long sessionOwner); static byte[] serializeClientId(String clientId); static String deserializeClientId(byte[] data); static String getLockIdFromPath(String path); @Override ZKSessionLock setLockListener(LockListener lockListener); @Override boolean isLockExpired(); @Override boolean isLockHeld(); @Override CompletableFuture<LockWaiter> asyncTryLock(final long timeout, final TimeUnit unit); @Override void tryLock(long timeout, TimeUnit unit); @Override CompletableFuture<Void> asyncUnlock(); @Override void unlock();  }### Answer:
@Test(timeout = 60000) public void testAreLockWaitersInSameSession() throws Exception { ZooKeeper zk = zkc.get(); String lockPath = "/test-are-lock-waiters-in-same-session"; String clientId1 = "test-are-lock-waiters-in-same-session-1"; String clientId2 = "test-are-lock-waiters-in-same-session-2"; createLockPath(zk, lockPath); String node1 = getLockIdFromPath(createLockNodeV3(zk, lockPath, clientId1)); String node2 = getLockIdFromPath(createLockNodeV3(zk, lockPath, clientId2)); String node3 = getLockIdFromPath(createLockNodeV3(zk, lockPath, clientId1)); assertEquals(node1 + " and " + node3 + " should be in same session.", true, areLockWaitersInSameSession(node1, node3)); assertEquals(node1 + " and " + node2 + " should be not in same session.", false, areLockWaitersInSameSession(node1, node2)); assertEquals(node3 + " and " + node2 + " should be not in same session.", false, areLockWaitersInSameSession(node3, node2)); }