spockframework / spockframework/spock

Allow BlockingVariable to be reused by adding a reset() method

Open
#312 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Module-Core Type-Enhancement
Dominant language
Java
Stars
3.6k
Forks
483
PR merge metrics
No merged PRs in 30d

Description

Originally reported on Google Code with ID 190

I have found it very useful to be able to reuse a blocking variable once it has been
used once.

I accomplished this with two minor compatible changes to the current BlockingVariable.java

change....

     private CountDownLatch valueReady = new CountDownLatch(1);

to be not final

add the method

    public void reset() {
          value= null;
          valueReady= new CountDownLatch(1);
    }

Then a call to reset() will allow the same blocking variable to be reused.

Reported by wolfmanjm on 2011-07-19 06:58:59

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating and reading BlockingVariable.java, especially the value and CountDownLatch fields described in the issue. Add the requested reset behavior so the same blocking variable can be used again after completion, then verify that the existing behavior remains compatible and that a reset allows another value to be received.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
testing
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.