| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Please choose to implement a pageview counter by:
Please use the below skeleton for the implementation of the logic
public static class PageVisitCounter
{
public void onPageVisit(String page)
{
//implement
}
public long getPageVisits(String page)
{
//implement
}
}
I have tried to implement the PageViewCounter in two three ways:
Update - 02March2022
The code is extensively commented to give an idea on my thinking while developing this code.
To compile and run the project:
checkout the project first using git clone
run mvn clean install in the parent directory
you can also run mvn test to run the tests
you will see the below lines which shows all the tests passed
------------------------------------------------------- T E S T S ------------------------------------------------------- Running PageVisitCounterWriteSafeReadUnsafeTest Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.603 sec Running PageVisitCounterLockFreeTest Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.448 sec Running PageVisitCounterReadWriteSafeTest Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.485 sec Results : Tests run: 9, Failures: 0, Errors: 0, Skipped: 0
I have used Java 11 SDK to compile and run the program.
This repository is released under the MIT license. In short, this means you are free to use this software in any personal, open-source or commercial projects. Attribution is optional but appreciated.
| Back | FazBrowse Home | New Git URL |