-
Notifications
You must be signed in to change notification settings - Fork 5
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
RESTful webservice to receive notifications of artifact uploads #28
Conversation
Thread thread = new Thread(new Runnable() { | ||
@Override | ||
public void run() { | ||
while (true){ |
There was a problem hiding this comment.
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()).
Couple of things to be fixed before proceeding with the review:
|
@@ -18,5 +18,6 @@ | |||
import com.griddynamics.cd.nrp.internal.model.api.ArtifactMetaInfo; | |||
|
|||
public interface ArtifactUpdateApiClient { | |||
void sendRequest(ArtifactMetaInfo metaInfo); | |||
void enqueueRequest(ArtifactMetaInfo artifactMetaInfo); |
There was a problem hiding this comment.
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()
?
f6d8b25
to
a63b873
Compare
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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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()
bee795f
to
696d6bc
Compare
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.
696d6bc
to
3b63c00
Compare
RESTful webservice to receive notifications of artifact uploads
Implementing issue:
#3
Please review and merge.