-
Notifications
You must be signed in to change notification settings - Fork 602
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
Feature/action manager priority queue #1526
Merged
badvision
merged 15 commits into
Adobe-Consulting-Services:master
from
shsteimer:feature/action-manager-priority-queue
Oct 26, 2018
Merged
Changes from 14 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
08666f1
added a priority to action manager that gets passed through to all su…
shsteimer 8cc710c
fixed tests
shsteimer 1286469
updated package info version due to interface updates
shsteimer 887efc2
added a test to check the execution order. This required some change…
shsteimer fb39e01
added java docs
shsteimer 38fe0d1
cleaned up the test a bit
shsteimer aa7da9e
fixed a param in some javadocs that was added by accident
shsteimer b9e0618
added to changelog, will update once I have a PR # for this change
shsteimer 7a1e944
added priority to the jmx stats
shsteimer de4ff55
added pr # to changelog
shsteimer 92114ab
changed tests to use proper log method with parameter passing
shsteimer a1a2284
added licence header comment to new files
shsteimer 44c2b9d
moved the default priority constant to a dedicated constants class to…
shsteimer 604b225
added license header to one class that I missed in previous check
shsteimer 97d660e
fixed spelling of priority in one method parameter name.
shsteimer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
bundle/src/main/java/com/adobe/acs/commons/fam/ActionManagerConstants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* #%L | ||
* ACS AEM Commons Bundle | ||
* %% | ||
* Copyright (C) 2018 Adobe | ||
* %% | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* #L% | ||
*/ | ||
|
||
package com.adobe.acs.commons.fam; | ||
|
||
public class ActionManagerConstants { | ||
|
||
private ActionManagerConstants() { | ||
//no instances of constants class | ||
} | ||
|
||
public static final int DEFAULT_ACTION_PRIORITY = 0; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
bundle/src/main/java/com/adobe/acs/commons/fam/impl/PriorityThreadPoolExecutor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* #%L | ||
* ACS AEM Commons Bundle | ||
* %% | ||
* Copyright (C) 2018 Adobe | ||
* %% | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* #L% | ||
*/ | ||
|
||
package com.adobe.acs.commons.fam.impl; | ||
|
||
import java.util.concurrent.BlockingQueue; | ||
import java.util.concurrent.RejectedExecutionHandler; | ||
import java.util.concurrent.RunnableFuture; | ||
import java.util.concurrent.ThreadFactory; | ||
import java.util.concurrent.ThreadPoolExecutor; | ||
import java.util.concurrent.TimeUnit; | ||
|
||
/** | ||
* A custom extension of the thread pool executor which uses our {@link TimedRunnableFuture} implementation. | ||
* This ensures that deferred tasks still respect the priority and don't cause errors when those are cast to {@link Comparable}. | ||
*/ | ||
public class PriorityThreadPoolExecutor extends ThreadPoolExecutor { | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public PriorityThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, | ||
BlockingQueue<Runnable> workQueue) { | ||
super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public PriorityThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, | ||
BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory) { | ||
super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public PriorityThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, | ||
BlockingQueue<Runnable> workQueue, RejectedExecutionHandler handler) { | ||
super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, handler); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public PriorityThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, | ||
BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory, RejectedExecutionHandler handler) { | ||
super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory, handler); | ||
} | ||
|
||
@Override | ||
protected <T> RunnableFuture<T> newTaskFor(Runnable runnable, T value) { | ||
return new TimedRunnableFuture(runnable, value); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Misspelled priority
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.
This is exactly the sort of high quality code review I expect.
Snark aside, will fix this, thanks for pointing it out.
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.
Hey, it's open-source. You're getting so much more than you paid for already! ;P But seriously, thanks for the awesome PR!