Skip to content

Queue-Based Load Leveling pattern #450

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

Closed
iluwatar opened this issue Jul 2, 2016 · 17 comments
Closed

Queue-Based Load Leveling pattern #450

iluwatar opened this issue Jul 2, 2016 · 17 comments
Milestone

Comments

@iluwatar
Copy link
Owner

iluwatar commented Jul 2, 2016

https://msdn.microsoft.com/en-us/library/dn589783.aspx

@Amarnath510
Copy link
Contributor

Amarnath510 commented Nov 5, 2016

@iluwatar
I want to work on this.
I have work ex on Java/J2EE but I am beginner to open source contributions so please help me.
Where can I start? Where to ask questions if there are any?

@iluwatar
Copy link
Owner Author

iluwatar commented Nov 5, 2016

@Amarnath510 your contribution is welcome. Please read https://github.com/iluwatar/java-design-patterns/wiki/01.-How-to-contribute first. You can ask discuss the implementation here or in the Gitter chat https://gitter.im/iluwatar/java-design-patterns.

@Amarnath510
Copy link
Contributor

@iluwatar
I have done a basic UML diagram in which I am presenting my classes, interfaces and their relationships.
uml

NOTE: I haven't followed any code conventions as of now. This is just for design discussions.

  • I have created 3 Worker threads each one submitting different number of tasks to the BlockingQueue. After each Message object submit the Thread sleeps for 0.001s.
  • ServiceExecutor class will pick up each Message object from the BlockingQueue and serves it.
  • No matter how much load is been submitted by the task(s) the ServiceExecutor will pick up only 1 message task at a time from the Queue.

This is my understanding and the UML diagram for the same. Please feel free to correct me.

@iluwatar
Copy link
Owner Author

@Amarnath510 according to my understanding of the pattern the design draft looks correct. The task generators produce tasks that go into a queue and the service consumes the tasks from the queue at its own rate.

@Amarnath510
Copy link
Contributor

@iluwatar
Thanks for the review.
Yes. The Task generators generate tasks at any rate and submit them to the queue and the ServiceExecutor executes the tasks one after the other from the Queue.
I will proceed to code and then if are any corrections we can discuss them during code review.

@iluwatar
Copy link
Owner Author

👍

@Amarnath510
Copy link
Contributor

Amarnath510 commented Nov 19, 2016

@iluwatar
I have completed coding. I want to send the code for review.
Can you please let me know the steps I have to do for the code review?
I have knowledge about usual "git init", "git commit" .. but it seems to be different here.
FYI, I have check-out the code using, "git clone https://github.com/iluwatar/java-design-patterns.git".

@iluwatar
Copy link
Owner Author

The steps are described here https://github.com/iluwatar/java-design-patterns/wiki/01.-How-to-contribute. Don't hesitate to ask if you need further information.

Amarnath510 pushed a commit to Amarnath510/java-design-patterns that referenced this issue Nov 20, 2016
@Amarnath510
Copy link
Contributor

@iluwatar
Thanks for your help. I have submitted the code for review.

Amarnath510 pushed a commit to Amarnath510/java-design-patterns that referenced this issue Nov 20, 2016
iluwatar added a commit that referenced this issue Nov 28, 2016
Issue #450. First commit. Queue Based Load Leveling
@iluwatar iluwatar added this to the 1.14.0 milestone Nov 28, 2016
@iluwatar
Copy link
Owner Author

The pattern example has been merged. The next steps would be to create a blog post or presentation about it. See #341 and #197 for more information.

@Amarnath510
Copy link
Contributor

@iluwatar
I have few questions regarding blog creation.
I read How to create Blog Entry
Following are the steps which I want to do,

  1. Should I do a pull request of branch gh_pages ?
  2. Then I should create a folder under _posts with name "queue-load-leveling" right?
  3. Give file name as, 2016-11-30-queue-load-leveling.md
  4. And write the blog as per the "Structure of the blogpost."

Are the steps correct?
I have a doubt at step-1 above so was asking.

@iluwatar
Copy link
Owner Author

@Amarnath510 the answer to all the questions is "yes, you got it right" 😄

@Amarnath510
Copy link
Contributor

@iluwatar
:)
Sorry to bother you. But I am facing issue that is the reason I wrote step by step above.
When I do a "new pull request" at gh-pages for branch gh-pages I got the below screen.

untitled

How do I pull the branch gh-pages?

@iluwatar
Copy link
Owner Author

iluwatar commented Dec 1, 2016

Try clicking the link "compare across forks" and selecting your fork's gh-pages branch.

@Amarnath510
Copy link
Contributor

@iluwatar
Thanks. Solved the issue. 👍

Amarnath510 added a commit to Amarnath510/java-design-patterns that referenced this issue Dec 8, 2016
@Amarnath510
Copy link
Contributor

@iluwatar
I have completed the blog. Please comment for the same.
There is a issue with the blog images. I have done the same as mentioned in the reference blog but the images are not resolving.

iluwatar added a commit that referenced this issue Jan 13, 2017
#450 Blog: Queue-Based Load Leveling Pattern
grzegorz2047 added a commit to grzegorz2047/java-design-patterns that referenced this issue Feb 13, 2017
* Initial commit of the object mother iluwatar#498

Add a simple king and queen classes which implement the behaviour of the
royalty interface. Also wrote the object mother of royalty objects which
is final so you can just call the static methods in it to create objects
with a specific state to use them fast in tests. The tests are already
created for testing the behaviour and the type of the objects which are
created by the object mother.
I also created the UML diagrams via object aid and updated the readme.

* Add PlantUML file for the UML diagram iluwatar#498

* End process logic clause has been corrected.

* Unused import removed.

* Add SonarQube.com badge

* iluwatar#502 Replaced usages of System.out with logger.

* Change name of variables in test iluwatar#498

* add entry to parent pom.xml iluwatar#498

* Fix pom.xml

* Fix pom.xml

Deleted </modules> tag because i added it one time more than neccessary

* FirstCut++

FirstCut++

* SecondCut++

SecondCut++

* App++

App++

* App

App

* checkstyle errors removed

checkstyle errors removed

* iluwatar#502 Reverted changes in composite example, due to nature of this example using logger isn't good idea

* Remove use of coveralls-maven-plugin (sonarqube.com covers this)

* iluwatar#502 Adjusted tests for logger introduction

* iluwatar#502 Introduced logging in new example

* Create presentation template

* Link Hexagonal Architecture pattern to corresponding blog entry

* Work on Hexagonal Architecture presentation

* Add new diagram

* Add presentation link to README.md

* Update App.java

The relationship between decorator and target (in the code example between Troll und SmartTroll) ist not a composition as described in the code comment lines of class App. It's a aggregation. In a composition both instances canncot live without the other one. But the target (Troll) could live without the decorator (Smart Troll). Changed "composition" to "aggregation" in the comment lines. Code lines are unchanged.
Greetings Thomas

* Review comments++

* Review comments++

* iluwatar#502 Reduced amount of information logged

* Issue iluwatar#450. First commit. Queue Based Load Leveling

* Issue iluwatar#450. Updated pom.xml

* Updated checkstyle errors.

* Updated pom.xml with maven-pmd-plugin

Added dependency "maven-pmd-plugin" to the pom file.

* Reverted pom.xml changes that are done previously.

* Fixed PMD issue.

* Decorator pattern: Improve the example

* Removed unused imports in tests

* Proxy pattern: Improve the example

* Proxy pattern: Add missing license header

* Update URM Version to 1.4.4 and regenerated all puml files

* Update license headers

* Fixed all the code changes after review

* Review comments++

* Sonar bug fixes using Yoda condition in equals expression when comparing String literal with String object.
Using try-with-resources if we use Scanner to close the underlying stream is a good practice to handle resources.
Minimal refactor.

* Sonar bug fixes using Yoda condition in equals expression when comparing String literal with String object.
Using try-with-resources if we use Scanner to close the underlying stream is a good practice to handle resources.
Minimal refactor.

* Adding initialization on demand holder idiom.

* Changing constant interface pattern with a Noninstantiable class

* Add some material for proxy presentation.

* Add presentation for Proxy pattern.

* Add link to Proxy presentation.

* Achieved milestone 1.14.0

* Set version for next development iteration

* iluwatar#525 Add link to Queue-Based Load Leveling blog

* iluwatar#525 Add link to proxy blog

* Changing code to use interfaces instead of implementations.

* Changing code to use interfaces instead of implementations.

* Reverting initialization on demand holder idiom.

* iluwatar#190 Regenerate puml files

* iluwatar#190 Rename package for Queue-Based Load Leveling pattern
@iluwatar
Copy link
Owner Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants