com.sonyericsson.hudson.plugins.gerrit.trigger.replication
Class ReplicationCache

java.lang.Object
  extended by com.sonyericsson.hudson.plugins.gerrit.trigger.replication.ReplicationCache

public class ReplicationCache
extends Object

Replication cache for RefReplicated events.

Author:
Hugo Arès <hugo.ares@ericsson.com>

Field Summary
static int DEFAULT_EXPIRATION_IN_MINUTES
          Cache expiration in minutes.
 
Constructor Summary
ReplicationCache()
          Default constructor.
ReplicationCache(long expiration, TimeUnit unit)
          Constructor use by default constructor and for unit tests.
 
Method Summary
 com.sonymobile.tools.gerrit.gerritevents.dto.events.RefReplicated getIfPresent(String gerritServer, String gerritProject, String ref, String slaveHost)
          Return the cached RefReplicated associated with the specified parameters, if found.
 boolean isExpired(long timestamp)
          Returns if the specified time stamp is expired.
 void put(com.sonymobile.tools.gerrit.gerritevents.dto.events.RefReplicated refReplicated)
          Cache the specified RefReplicated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_EXPIRATION_IN_MINUTES

public static final int DEFAULT_EXPIRATION_IN_MINUTES
Cache expiration in minutes.

Constructor Detail

ReplicationCache

public ReplicationCache()
Default constructor.


ReplicationCache

public ReplicationCache(long expiration,
                        TimeUnit unit)
Constructor use by default constructor and for unit tests.

Parameters:
expiration - Cache expiration
unit - the unit that expiration is expressed in
Method Detail

put

public void put(com.sonymobile.tools.gerrit.gerritevents.dto.events.RefReplicated refReplicated)
Cache the specified RefReplicated.

Parameters:
refReplicated - the event to cache

isExpired

public boolean isExpired(long timestamp)
Returns if the specified time stamp is expired.

Parameters:
timestamp - the time stamp to check.
Returns:
true if expired, otherwise false

getIfPresent

public com.sonymobile.tools.gerrit.gerritevents.dto.events.RefReplicated getIfPresent(String gerritServer,
                                                                                      String gerritProject,
                                                                                      String ref,
                                                                                      String slaveHost)
Return the cached RefReplicated associated with the specified parameters, if found.

Parameters:
gerritServer - The gerritServer
gerritProject - The gerritProject
ref - The ref
slaveHost - The slaveHost
Returns:
the RefReplicated if found, otherwise null


Copyright © 2004-2014. All Rights Reserved.