Skip to content

Commit

Permalink
Merge pull request #46 from DevFactory/release/general-code-quality-f…
Browse files Browse the repository at this point in the history
…ix-3

General code quality fix-4
  • Loading branch information
rsandell committed Feb 26, 2016
2 parents 309a8cb + 5954fec commit a01f254
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
*/
public class Semaphore {

private java.util.concurrent.Semaphore semaphore;
private java.util.concurrent.Semaphore semaphoreLock;

/**
* Standard constructor.
*/
public Semaphore() {
semaphore = new java.util.concurrent.Semaphore(0);
semaphoreLock = new java.util.concurrent.Semaphore(0);
}

/**
Expand All @@ -46,19 +46,19 @@ public Semaphore() {
*/
public void acquire() throws InterruptedException {
int take;
if (semaphore.availablePermits() < 1) {
if (semaphoreLock.availablePermits() < 1) {
take = 1;
} else {
take = semaphore.availablePermits();
take = semaphoreLock.availablePermits();
}
semaphore.acquire(take);
semaphoreLock.acquire(take);
}

/**
* @see java.util.concurrent.Semaphore#release()
* Releases a permit, returning it to the semaphore.
*/
public void release() {
semaphore.release();
semaphoreLock.release();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ private boolean isSlave() {
if (computer == null) {
return false;
}
return (computer.getNode() instanceof Slave);
return computer.getNode() instanceof Slave;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ public class FoundIndication {
*/
protected static final String FILE_ENCODING = System.getProperty("file.encoding");
private String matchingFile;
/**
* @deprecated, kept for backwards compatibility.
*/
@Deprecated
private transient Integer matchingLine;
private String pattern;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public Statistics(@JsonProperty("projectName") String projectName,
}

/**
* Deprecated, kept for backwards compatibility.
* @deprecated, kept for backwards compatibility.
* @param projectName the project name.
* @param buildNumber the build number.
* @param startingTime the starting time.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class SemaphoreTest {
@Test(timeout = 20000)
public void testAcquireAndRelease() throws Exception {
Semaphore semaphore = new Semaphore();
java.util.concurrent.Semaphore innerSemaphore = Whitebox.getInternalState(semaphore, "semaphore");
java.util.concurrent.Semaphore innerSemaphore = Whitebox.getInternalState(semaphore, "semaphoreLock");
assertEquals("The semaphore should have no available permits to start with", 0,
innerSemaphore.availablePermits());
semaphore.release();
Expand Down

0 comments on commit a01f254

Please sign in to comment.