comparison src/org/tmatesoft/hg/repo/HgRepositoryLock.java @ 631:8a5cdcb27b8f

AIOOBE in HgManifest.RevisionMapper. Provide more details about exception context. Create lock file atomically. Test concurrent pull-rebase and read
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 30 May 2013 15:24:17 +0200
parents 5afc7eedb3dd
children 5d8798772cca
comparison
equal deleted inserted replaced
630:72c979555cb8 631:8a5cdcb27b8f
118 byte[] bytes = lockDescription.toString().getBytes(); 118 byte[] bytes = lockDescription.toString().getBytes();
119 long stopTime = timeoutSeconds < 0 ? -1 : (System.currentTimeMillis() + timeoutSeconds*1000); 119 long stopTime = timeoutSeconds < 0 ? -1 : (System.currentTimeMillis() + timeoutSeconds*1000);
120 do { 120 do {
121 synchronized(this) { 121 synchronized(this) {
122 try { 122 try {
123 if (!lockFile.exists()) { 123 if (lockFile.createNewFile()) {
124 write(lockFile, bytes); 124 write(lockFile, bytes);
125 use++; 125 use++;
126 return; 126 return;
127 } 127 }
128 } catch (IOException ex) { 128 } catch (IOException ex) {