private volatile String bindingAddress;
private boolean mapRegisterCacheEnabled;
+ private long mapRegisterCacheTimeout;
+
private static Object startLock = new Object();
private final ClusterNodeModulSwitcherImpl clusterNodeModulSwitcher;
private LispSouthboundHandler lispSouthboundHandler;
lispSouthboundHandler.setDataBroker(dataBroker);
lispSouthboundHandler.setNotificationProvider(this.notificationPublishService);
lispSouthboundHandler.setMapRegisterCacheEnabled(mapRegisterCacheEnabled);
+ lispSouthboundHandler.setMapRegisterCacheTimeout(mapRegisterCacheTimeout);
lispSouthboundHandler.init();
lispSouthboundHandler.restoreDaoFromDatastore();
}
}
+ public void setMapRegisterCacheTimeout(long mapRegisterCacheTimeout) {
+ this.mapRegisterCacheTimeout = mapRegisterCacheTimeout;
+ }
+
public void setBindingAddress(String bindingAddress) {
this.bindingAddress = bindingAddress;
}
implements ILispSouthboundService, AutoCloseable {
private MapRegisterCache mapRegisterCache;
private boolean mapRegisterCacheEnabled = true;
+ private long mapRegisterCacheTimeout;
- /**
- * How long is record supposed to be relevant. After this time record isn't valid.
- *
- * If you modify this value, please update the LispSouthboundServiceTest class too.
- */
- private static final long CACHE_RECORD_TIMEOUT = 90000;
private DataBroker dataBroker;
-
private NotificationPublishService notificationPublishService;
+
protected static final Logger LOG = LoggerFactory.getLogger(LispSouthboundHandler.class);
//TODO: think whether this field can be accessed through mappingservice or some other configuration parameter
private boolean authenticationEnabled = true;
-
private final LispSouthboundPlugin lispSbPlugin;
private LispSouthboundStats lispSbStats = null;
private SimpleMapCache smc;
private MapRegisterCacheValue refreshAuthKeyIfNecessary(MapRegisterCacheValue mapRegisterCacheValue) {
if (authenticationKeyDataListener.isAuthKeyRefreshing()) {
final boolean shouldAuthKeyRefreshingStop = System.currentTimeMillis() - authenticationKeyDataListener
- .getAuthKeyRefreshingDate() > CACHE_RECORD_TIMEOUT;
+ .getAuthKeyRefreshingDate() > mapRegisterCacheTimeout;
if (shouldAuthKeyRefreshingStop) {
authenticationKeyDataListener.setAuthKeyRefreshing(false);
} else {
if (mapRegisterCacheValue != null) {
final long creationTime = mapRegisterCacheValue.getMapRegisterCacheMetadata().getTimestamp();
final long currentTime = System.currentTimeMillis();
- if (currentTime - creationTime > CACHE_RECORD_TIMEOUT) {
+ if (currentTime - creationTime > mapRegisterCacheTimeout) {
mapRegisterCache.removeEntry(entry.getKey());
return null;
} else if (Arrays.equals(mapRegisterCacheValue.getPacketData(), entry.getValue())) {
public void setIsReadFromChannelEnabled(boolean isReadFromChannelEnabled) {
this.isReadFromChannelEnabled = isReadFromChannelEnabled;
}
+
+ public void setMapRegisterCacheTimeout(long mapRegisterCacheTimeout) {
+ this.mapRegisterCacheTimeout = mapRegisterCacheTimeout;
+ }
}
<cm:default-properties>
<cm:property name="bindingAddressProperty" value="0.0.0.0" />
<cm:property name="mapRegisterCacheEnabledProperty" value="true" />
+ <cm:property name="mapRegisterCacheTimeoutProperty" value="90000"/>
</cm:default-properties>
</cm:property-placeholder>
<argument ref="entityOwnershipService" />
<property name="bindingAddress" value="${bindingAddressProperty}"/>
<property name="mapRegisterCacheEnabled" value="${mapRegisterCacheEnabledProperty}"/>
+ <property name="mapRegisterCacheTimeout" value="${mapRegisterCacheTimeoutProperty}"/>
</bean>
<service ref="lispSouthboundPlugin"
interface="org.opendaylight.lispflowmapping.type.sbplugin.IConfigLispSouthboundPlugin"