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
alshabib
2014-10-17 17:17:15 -0700
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
a9a61c12428a2fe98061e59277dfea78b55af49c
a9a61c12
2 parents
4a179dca
8a895099
Merge branch 'master' of
ssh://gerrit.onlab.us:29418/onos-next
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
1 deletions
core/api/src/main/java/org/onlab/onos/store/cluster/messaging/ClusterMessage.java
core/store/dist/src/main/java/org/onlab/onos/store/cluster/messaging/impl/ClusterCommunicationManager.java
core/api/src/main/java/org/onlab/onos/store/cluster/messaging/ClusterMessage.java
View file @
a9a61c1
package
org
.
onlab
.
onos
.
store
.
cluster
.
messaging
;
import
java.io.IOException
;
import
org.onlab.onos.cluster.NodeId
;
// TODO: Should payload type be ByteBuffer?
...
...
@@ -49,4 +51,14 @@ public class ClusterMessage {
public
byte
[]
payload
()
{
return
payload
;
}
/**
* Sends a response to the sender.
*
* @param data payload response.
* @throws IOException
*/
public
void
respond
(
byte
[]
data
)
throws
IOException
{
throw
new
IllegalStateException
(
"One can only repond to message recived from others."
);
}
}
...
...
core/store/dist/src/main/java/org/onlab/onos/store/cluster/messaging/impl/ClusterCommunicationManager.java
View file @
a9a61c1
...
...
@@ -158,7 +158,7 @@ public class ClusterCommunicationManager
public
void
handle
(
Message
message
)
{
try
{
ClusterMessage
clusterMessage
=
SERIALIZER
.
decode
(
message
.
payload
());
handler
.
handle
(
clusterMessage
);
handler
.
handle
(
new
InternalClusterMessage
(
clusterMessage
,
message
)
);
}
catch
(
Exception
e
)
{
log
.
error
(
"Exception caught during ClusterMessageHandler"
,
e
);
throw
e
;
...
...
@@ -166,6 +166,21 @@ public class ClusterCommunicationManager
}
}
public
static
final
class
InternalClusterMessage
extends
ClusterMessage
{
private
final
Message
rawMessage
;
public
InternalClusterMessage
(
ClusterMessage
clusterMessage
,
Message
rawMessage
)
{
super
(
clusterMessage
.
sender
(),
clusterMessage
.
subject
(),
clusterMessage
.
payload
());
this
.
rawMessage
=
rawMessage
;
}
@Override
public
void
respond
(
byte
[]
response
)
throws
IOException
{
rawMessage
.
respond
(
response
);
}
}
private
static
final
class
InternalClusterMessageResponse
implements
ClusterMessageResponse
{
private
final
NodeId
sender
;
...
...
Please
register
or
login
to post a comment