Toggle navigation
Toggle navigation
This project
Loading...
Sign in
홍길동
/
onos
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Jonathan Hart
2014-10-02 19:08:55 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
34ed2fd61b80924e9accfc3d394260607d4f83e3
34ed2fd6
1 parent
0d1feb26
Cleaned up HostMonitor and support HostProvider invalidation
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
19 deletions
core/net/src/main/java/org/onlab/onos/net/host/impl/HostMonitor.java
core/net/src/main/java/org/onlab/onos/net/host/impl/HostMonitor.java
View file @
34ed2fd
...
...
@@ -4,9 +4,9 @@ import java.nio.ByteBuffer;
import
java.util.ArrayList
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentMap
;
import
java.util.concurrent.TimeUnit
;
import
org.jboss.netty.util.Timeout
;
...
...
@@ -59,15 +59,14 @@ public class HostMonitor implements TimerTask {
private
final
Set
<
IpAddress
>
monitoredAddresses
;
private
final
Map
<
ProviderId
,
HostProvider
>
hostProviders
;
private
final
Concurrent
Map
<
ProviderId
,
HostProvider
>
hostProviders
;
private
final
long
probeRate
;
private
static
final
long
DEFAULT_PROBE_RATE
=
30000
;
// milliseconds
private
long
probeRate
=
DEFAULT_PROBE_RATE
;
private
final
Timeout
timeout
;
public
HostMonitor
(
DeviceService
deviceService
,
PacketService
packetService
,
public
HostMonitor
(
DeviceService
deviceService
,
PacketService
packetService
,
HostManager
hostService
)
{
this
.
deviceService
=
deviceService
;
...
...
@@ -77,15 +76,7 @@ public class HostMonitor implements TimerTask {
monitoredAddresses
=
new
HashSet
<>();
hostProviders
=
new
ConcurrentHashMap
<>();
probeRate
=
30000
;
// milliseconds
timeout
=
Timer
.
getTimer
().
newTimeout
(
this
,
0
,
TimeUnit
.
MILLISECONDS
);
addDefaultAddresses
();
}
private
void
addDefaultAddresses
()
{
//monitoredAddresses.add(IpAddress.valueOf("10.0.0.1"));
}
void
addMonitoringFor
(
IpAddress
ip
)
{
...
...
@@ -104,10 +95,6 @@ public class HostMonitor implements TimerTask {
hostProviders
.
put
(
provider
.
id
(),
provider
);
}
void
unregisterHostProvider
(
HostProvider
provider
)
{
// TODO find out how to call this
}
@Override
public
void
run
(
Timeout
timeout
)
throws
Exception
{
for
(
IpAddress
ip
:
monitoredAddresses
)
{
...
...
@@ -121,7 +108,9 @@ public class HostMonitor implements TimerTask {
}
else
{
for
(
Host
host
:
hosts
)
{
HostProvider
provider
=
hostProviders
.
get
(
host
.
providerId
());
if
(
provider
!=
null
)
{
if
(
provider
==
null
)
{
hostProviders
.
remove
(
host
.
providerId
(),
null
);
}
else
{
provider
.
triggerProbe
(
host
);
}
}
...
...
Please
register
or
login
to post a comment