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
Madan Jampani
2014-10-09 12:08:20 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
255a58b8b994e7a7c607e443f4955af64ebefab6
255a58b8
1 parent
7dbbabff
GossipDeviceStore: Notifying applications of latest topology events received from peers
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
5 deletions
core/api/src/main/java/org/onlab/onos/store/AbstractStore.java
core/store/dist/src/main/java/org/onlab/onos/store/device/impl/GossipDeviceStore.java
core/api/src/main/java/org/onlab/onos/store/AbstractStore.java
View file @
255a58b
package
org
.
onlab
.
onos
.
store
;
import
java.util.List
;
import
org.onlab.onos.event.Event
;
import
static
com
.
google
.
common
.
base
.
Preconditions
.
checkState
;
...
...
@@ -41,4 +43,15 @@ public class AbstractStore<E extends Event, D extends StoreDelegate<E>>
delegate
.
notify
(
event
);
}
}
/**
* Notifies the delegate with the specified list of events.
*
* @param events list of events to delegate
*/
protected
void
notifyDelegate
(
List
<
E
>
events
)
{
for
(
E
event:
events
)
{
notifyDelegate
(
event
);
}
}
}
...
...
core/store/dist/src/main/java/org/onlab/onos/store/device/impl/GossipDeviceStore.java
View file @
255a58b
...
...
@@ -870,6 +870,12 @@ public class GossipDeviceStore
clusterCommunicator
.
broadcast
(
message
);
}
private
void
notifyDelegateIfNotNull
(
DeviceEvent
event
)
{
if
(
event
!=
null
)
{
notifyDelegate
(
event
);
}
}
private
class
InternalDeviceEventListener
implements
ClusterMessageHandler
{
@Override
public
void
handle
(
ClusterMessage
message
)
{
...
...
@@ -881,7 +887,7 @@ public class GossipDeviceStore
DeviceId
deviceId
=
event
.
deviceId
();
Timestamped
<
DeviceDescription
>
deviceDescription
=
event
.
deviceDescription
();
createOrUpdateDeviceInternal
(
providerId
,
deviceId
,
deviceDescription
);
notifyDelegateIfNotNull
(
createOrUpdateDeviceInternal
(
providerId
,
deviceId
,
deviceDescription
)
);
}
}
...
...
@@ -895,7 +901,7 @@ public class GossipDeviceStore
DeviceId
deviceId
=
event
.
deviceId
();
Timestamp
timestamp
=
event
.
timestamp
();
markOfflineInternal
(
deviceId
,
timestamp
);
notifyDelegateIfNotNull
(
markOfflineInternal
(
deviceId
,
timestamp
)
);
}
}
...
...
@@ -909,7 +915,7 @@ public class GossipDeviceStore
DeviceId
deviceId
=
event
.
deviceId
();
Timestamp
timestamp
=
event
.
timestamp
();
removeDeviceInternal
(
deviceId
,
timestamp
);
notifyDelegateIfNotNull
(
removeDeviceInternal
(
deviceId
,
timestamp
)
);
}
}
...
...
@@ -924,7 +930,7 @@ public class GossipDeviceStore
DeviceId
deviceId
=
event
.
deviceId
();
Timestamped
<
List
<
PortDescription
>>
portDescriptions
=
event
.
portDescriptions
();
updatePortsInternal
(
providerId
,
deviceId
,
portDescriptions
);
notifyDelegate
(
updatePortsInternal
(
providerId
,
deviceId
,
portDescriptions
)
);
}
}
...
...
@@ -939,7 +945,7 @@ public class GossipDeviceStore
DeviceId
deviceId
=
event
.
deviceId
();
Timestamped
<
PortDescription
>
portDescription
=
event
.
portDescription
();
updatePortStatusInternal
(
providerId
,
deviceId
,
portDescription
);
notifyDelegateIfNotNull
(
updatePortStatusInternal
(
providerId
,
deviceId
,
portDescription
)
);
}
}
}
...
...
Please
register
or
login
to post a comment