Mercurial > jhg
comparison src/org/tmatesoft/hg/repo/HgRepositoryLock.java @ 638:2f1cd1c26de5 smartgit-4.5
AIOOBE in HgManifest.RevisionMapper: provide more details about exception context. Create lock file atomically. Picked from changeset 8a5cdcb27b8f
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Fri, 07 Jun 2013 13:21:20 +0200 |
parents | 3cd3c3d37432 |
children | 5d8798772cca |
comparison
equal
deleted
inserted
replaced
590:8cbc2a883d95 | 638:2f1cd1c26de5 |
---|---|
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) { |