mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
add IPC test
This commit is contained in:
parent
54f9a5de65
commit
28db7981b9
@ -260,6 +260,7 @@ public class EventBusBase implements EventBus {
|
||||
}
|
||||
|
||||
private static class SubscriptionNode {
|
||||
@SuppressWarnings("unused")
|
||||
private String _nodeKey;
|
||||
private List<Subscriber> _subscribers;
|
||||
private Map<String, SubscriptionNode> _children;
|
||||
@ -275,6 +276,7 @@ public class EventBusBase implements EventBus {
|
||||
_children = new HashMap<String, SubscriptionNode>();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public List<Subscriber> getSubscriber() {
|
||||
return _subscribers;
|
||||
}
|
||||
|
||||
@ -64,6 +64,7 @@ public class JsonMessageSerializer implements MessageSerializer {
|
||||
return sbuf.toString();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <T> T serializeFrom(String message) {
|
||||
assert(message != null);
|
||||
|
||||
@ -32,6 +32,7 @@ public class RpcClientCallImpl implements RpcClientCall {
|
||||
private Map<String, Object> _contextParams = new HashMap<String, Object>();
|
||||
private boolean _oneway = false;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private List<RpcCallbackListener> _callbackListeners = new ArrayList<RpcCallbackListener>();
|
||||
private Object _callbackDispatcherTarget;
|
||||
|
||||
@ -190,6 +191,7 @@ public class RpcClientCallImpl implements RpcClientCall {
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void complete(String result) {
|
||||
_responseResult = result;
|
||||
|
||||
@ -201,7 +203,7 @@ public class RpcClientCallImpl implements RpcClientCall {
|
||||
if(_callbackListeners.size() > 0) {
|
||||
assert(_rpcProvider.getMessageSerializer() != null);
|
||||
Object resultObject = _rpcProvider.getMessageSerializer().serializeFrom(result);
|
||||
for(RpcCallbackListener listener: _callbackListeners)
|
||||
for(@SuppressWarnings("rawtypes") RpcCallbackListener listener: _callbackListeners)
|
||||
listener.onSuccess(resultObject);
|
||||
} else {
|
||||
if(_callbackDispatcherTarget != null)
|
||||
@ -219,7 +221,7 @@ public class RpcClientCallImpl implements RpcClientCall {
|
||||
}
|
||||
|
||||
if(_callbackListeners.size() > 0) {
|
||||
for(RpcCallbackListener listener: _callbackListeners)
|
||||
for(@SuppressWarnings("rawtypes") RpcCallbackListener listener: _callbackListeners)
|
||||
listener.onFailure(e);
|
||||
} else {
|
||||
if(_callbackDispatcherTarget != null)
|
||||
|
||||
@ -113,7 +113,7 @@ public class RpcProviderImpl implements RpcProvider {
|
||||
@Override
|
||||
public void sendRpcPdu(String sourceAddress, String targetAddress, String serializedPdu) {
|
||||
assert(_transportProvider != null);
|
||||
_transportProvider.sendMessage(sourceAddress, targetAddress, this.RPC_MULTIPLEXIER, serializedPdu);
|
||||
_transportProvider.sendMessage(sourceAddress, targetAddress, RpcProvider.RPC_MULTIPLEXIER, serializedPdu);
|
||||
}
|
||||
|
||||
protected synchronized long getNextCallTag() {
|
||||
|
||||
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.cloudstack.framework.messaging;
|
||||
|
||||
public class SampleComponent extends ComponentEndpoint {
|
||||
|
||||
public SampleComponent() {
|
||||
}
|
||||
|
||||
@RpcServiceHandler(command="StartCommand")
|
||||
void onStartCommand(RpcServerCall call) {
|
||||
call.completeCall("Call response");
|
||||
}
|
||||
|
||||
@RpcCallbackHandler(command="StartCommand")
|
||||
void onStartCommandCallback(RpcClientCall call) {
|
||||
}
|
||||
|
||||
@EventHandler(topic="network.prepare")
|
||||
void onPrepareNetwork(String sender, String topic, Object args) {
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user