Skip to content
Permalink
Browse files

[FIXED JENKINS-19691] - Added the hudson.model.Queue.cacheRefreshPeri…

…od option

The option allows to manage the refresh period of the internal queue cache.

Signed-off-by: Oleg Nenashev <o.v.nenashev@gmail.com>
  • Loading branch information
oleg-nenashev committed Aug 14, 2014
1 parent 1568a8b commit 0d825984ff7460f988b0a272a33dc60acc30e415
Showing with 9 additions and 1 deletion.
  1. +9 −1 core/src/main/java/hudson/model/Queue.java
@@ -148,6 +148,14 @@
*/
@ExportedBean
public class Queue extends ResourceController implements Saveable {

/**
* Defines the refresh period for of the internal cache ({@link #itemsView}).
* Data should be defined in milliseconds, default value - 1000;
* @since TODO: define the version
*/
private static int CACHE_REFRESH_PERIOD = Integer.getInteger(Queue.class.getName() + ".cacheRefreshPeriod", 1000);

/**
* Items that are waiting for its quiet period to pass.
*
@@ -208,7 +216,7 @@
long t = System.currentTimeMillis();
long d = expires.get();
if (t>d) {// need to refresh the cache
long next = t+1000;
long next = t+CACHE_REFRESH_PERIOD;
if (expires.compareAndSet(d,next)) {
// avoid concurrent cache update via CAS.
// if the getItems() lock is contended,

0 comments on commit 0d82598

Please sign in to comment.
You can’t perform that action at this time.