Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RESTful webservice to receive notifications of artifact uploads #28

Merged
merged 1 commit into from
Jul 2, 2015

Conversation

gd-tmagrys
Copy link
Contributor

Implementing issue:

#3

Please review and merge.

Thread thread = new Thread(new Runnable() {
@Override
public void run() {
while (true){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would replaced it with while (!Thread.currentThread().isInterrupted()).

@ctapobep
Copy link

Couple of things to be fixed before proceeding with the review:

  • Commit message doesn't contain any details of what was done, why it was done and why it was done in that particular way (though the latter can be replaced with javadocs).
  • Something's wrong with formatting, looks sloppy.

@@ -18,5 +18,6 @@
import com.griddynamics.cd.nrp.internal.model.api.ArtifactMetaInfo;

public interface ArtifactUpdateApiClient {
void sendRequest(ArtifactMetaInfo metaInfo);
void enqueueRequest(ArtifactMetaInfo artifactMetaInfo);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enqueue.. sounds weird :) What about offer(), put() or add()?

@gd-tmagrys gd-tmagrys force-pushed the rest-notifications branch 5 times, most recently from f6d8b25 to a63b873 Compare June 30, 2015 08:40
@gd-tmagrys
Copy link
Contributor Author

I updated commit message and formatting. Also I changed method name.

* @param password User's password
* @return HTTP client
*/
private Client getClient(String login, String password) {
ClientConfig config = new DefaultClientConfig();
Client client = Client.create(config);
client.setExecutorService(asyncRequestsExecutorService);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gd-tmagrys, I am not sure but I think that all Clients will not use the same thread executor. When I tested code without this line separate executor was created for the each client. So that we can not limit threads count.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, so I'll revert this change and there will be 2 executors:

  • first only for this Client
  • second for ArtifactMetaInfos from fileBockingQueue and executing this.sendRequest()

@gd-tmagrys gd-tmagrys force-pushed the rest-notifications branch 2 times, most recently from bee795f to 696d6bc Compare June 30, 2015 12:52
griddynamics#3

ArtifactUpdateApiClient#offerRequest now does not work in blocking way.
Request is being added to internal queue.
Background thread iterates through this queue, and submit Runnables to Executor.
@gd-tmagrys gd-tmagrys force-pushed the rest-notifications branch from 696d6bc to 3b63c00 Compare June 30, 2015 12:53
alekseysemenov added a commit that referenced this pull request Jul 2, 2015
RESTful webservice to receive notifications of artifact uploads
@alekseysemenov alekseysemenov merged commit 62fa3ab into griddynamics:master Jul 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants