Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
floodlight
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
croft1
floodlight
Commits
ab4f80f9
Commit
ab4f80f9
authored
12 years ago
by
Ananth Suryanarayana
Browse files
Options
Downloads
Patches
Plain Diff
BSC-1846 : Trigger entities cleanup upon address space configuration change
parent
ed16111f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java
+23
-9
23 additions, 9 deletions
...tcontroller/devicemanager/internal/DeviceManagerImpl.java
with
23 additions
and
9 deletions
src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java
+
23
−
9
View file @
ab4f80f9
...
@@ -638,7 +638,7 @@ IFlowReconcileListener, IInfoProvider, IHAListener {
...
@@ -638,7 +638,7 @@ IFlowReconcileListener, IInfoProvider, IHAListener {
Runnable
ecr
=
new
Runnable
()
{
Runnable
ecr
=
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
cleanupEntities
(
false
);
cleanupEntities
(
false
,
null
);
entityCleanupTask
.
reschedule
(
ENTITY_CLEANUP_INTERVAL
,
entityCleanupTask
.
reschedule
(
ENTITY_CLEANUP_INTERVAL
,
TimeUnit
.
SECONDS
);
TimeUnit
.
SECONDS
);
}
}
...
@@ -1281,12 +1281,16 @@ IFlowReconcileListener, IInfoProvider, IHAListener {
...
@@ -1281,12 +1281,16 @@ IFlowReconcileListener, IInfoProvider, IHAListener {
* @param reclassify if true, begin an asynchronous task to reclassify the
* @param reclassify if true, begin an asynchronous task to reclassify the
* flushed entities
* flushed entities
*/
*/
private
void
flushEntityCache
(
IEntityClass
entityClass
,
private
void
flushEntityCache
(
IEntityClass
entityClass
,
boolean
reclassify
,
boolean
reclassify
)
{
Set
<
String
>
entityClassChanged
)
{
if
(
reclassify
)
return
;
// TODO
if
(
reclassify
)
return
;
// TODO
if
(
entityClass
==
null
)
{
if
(
entityClass
==
null
)
{
cleanupEntities
(
true
);
/*
* XXX This can be running at the same time by timer thread.
*/
cleanupEntities
(
true
,
entityClassChanged
);
}
else
{
}
else
{
// TODO
// TODO
}
}
...
@@ -1301,14 +1305,15 @@ IFlowReconcileListener, IInfoProvider, IHAListener {
...
@@ -1301,14 +1305,15 @@ IFlowReconcileListener, IInfoProvider, IHAListener {
/*
/*
* Flush the entire device entity cache for now.
* Flush the entire device entity cache for now.
*/
*/
flushEntityCache
(
null
,
false
);
flushEntityCache
(
null
,
false
,
entityClassNames
);
return
;
return
;
}
}
/**
/**
* Clean up expired entities/devices
* Clean up expired entities/devices
*/
*/
protected
void
cleanupEntities
(
boolean
forceExpiry
)
{
protected
void
cleanupEntities
(
boolean
forceCleanup
,
Set
<
String
>
specificEntities
)
{
Calendar
c
=
Calendar
.
getInstance
();
Calendar
c
=
Calendar
.
getInstance
();
c
.
add
(
Calendar
.
MILLISECOND
,
-
ENTITY_TIMEOUT
);
c
.
add
(
Calendar
.
MILLISECOND
,
-
ENTITY_TIMEOUT
);
Date
cutoff
=
c
.
getTime
();
Date
cutoff
=
c
.
getTime
();
...
@@ -1323,14 +1328,23 @@ IFlowReconcileListener, IInfoProvider, IHAListener {
...
@@ -1323,14 +1328,23 @@ IFlowReconcileListener, IInfoProvider, IHAListener {
while
(
diter
.
hasNext
())
{
while
(
diter
.
hasNext
())
{
Device
d
=
diter
.
next
();
Device
d
=
diter
.
next
();
/*
* If we are cleaning entities for a specific set of devices,
* skip if not applicable.
*/
if
(
specificEntities
!=
null
&&
d
.
getEntityClass
()
!=
null
&&
!
specificEntities
.
contains
(
d
.
getEntityClass
().
getName
()))
{
continue
;
}
while
(
true
)
{
while
(
true
)
{
deviceUpdates
.
clear
();
deviceUpdates
.
clear
();
toRemove
.
clear
();
toRemove
.
clear
();
toKeep
.
clear
();
toKeep
.
clear
();
for
(
Entity
e
:
d
.
getEntities
())
{
for
(
Entity
e
:
d
.
getEntities
())
{
if
(
force
Expiry
||
if
(
force
Cleanup
||
(
e
.
getLastSeenTimestamp
()
!=
null
&&
(
e
.
getLastSeenTimestamp
()
!=
null
&&
0
>
e
.
getLastSeenTimestamp
().
compareTo
(
cutoff
)))
{
0
>
e
.
getLastSeenTimestamp
().
compareTo
(
cutoff
)))
{
// individual entity needs to be removed
// individual entity needs to be removed
toRemove
.
add
(
e
);
toRemove
.
add
(
e
);
}
else
{
}
else
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment