comparison src/org/tmatesoft/hg/repo/HgRepository.java @ 488:45b3b6ca046f

Repository locking mechanism is alive
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Mon, 13 Aug 2012 19:07:59 +0200
parents db48a77ec8ff
children b3c16d1aede0
comparison
equal deleted inserted replaced
487:db48a77ec8ff 488:45b3b6ca046f
437 */ 437 */
438 @Experimental(reason="WORK IN PROGRESS") 438 @Experimental(reason="WORK IN PROGRESS")
439 public HgRepositoryLock getWorkingDirLock() { 439 public HgRepositoryLock getWorkingDirLock() {
440 if (wdLock == null) { 440 if (wdLock == null) {
441 int timeout = getLockTimeout(); 441 int timeout = getLockTimeout();
442 File lf = new File(getRepositoryRoot(), "wlock");
442 synchronized (this) { 443 synchronized (this) {
443 if (wdLock == null) { 444 if (wdLock == null) {
444 wdLock = new HgRepositoryLock(new File(repoPathHelper.rewrite("wlock").toString()), timeout); 445 wdLock = new HgRepositoryLock(lf, timeout);
445 } 446 }
446 } 447 }
447 } 448 }
448 return wdLock; 449 return wdLock;
449 } 450 }
450 451
451 @Experimental(reason="WORK IN PROGRESS") 452 @Experimental(reason="WORK IN PROGRESS")
452 public HgRepositoryLock getStoreLock() { 453 public HgRepositoryLock getStoreLock() {
453 if (storeLock == null) { 454 if (storeLock == null) {
454 int timeout = getLockTimeout(); 455 int timeout = getLockTimeout();
456 File fl = new File(getRepositoryRoot(), repoPathHelper.rewrite("lock").toString());
455 synchronized (this) { 457 synchronized (this) {
456 if (storeLock == null) { 458 if (storeLock == null) {
457 storeLock = new HgRepositoryLock(new File(repoPathHelper.rewrite("store/lock").toString()), timeout); 459 storeLock = new HgRepositoryLock(fl, timeout);
458 } 460 }
459 } 461 }
460 } 462 }
461 return storeLock; 463 return storeLock;
462 } 464 }