the return value of Invoke/Submit should be a meta data object that contains a sequence number and a unique identifier (using the id-generator). The generator needs to be synchronised.
Instead of introducing a new lock to ensure that the meta object is created ok, we should tap into the existing critcal section that has already been established. The call to retrieveWorker is internally protected by a lock, so perhaps we could tap into this, but bear in mind, that until the pool is at capacity, multiple GRs could still be able to access the shared resource concurrently, so be careful of this.
the return value of Invoke/Submit should be a meta data object that contains a sequence number and a unique identifier (using the id-generator). The generator needs to be synchronised.
Instead of introducing a new lock to ensure that the meta object is created ok, we should tap into the existing critcal section that has already been established. The call to retrieveWorker is internally protected by a lock, so perhaps we could tap into this, but bear in mind, that until the pool is at capacity, multiple GRs could still be able to access the shared resource concurrently, so be careful of this.