mirror of https://github.com/apache/cloudstack.git
Add RpcAddressable to allow upper layer adding address mapping logic for its business object
This commit is contained in:
parent
1688919218
commit
eee58d7804
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* 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 interface RpcAddressable {
|
||||
String getAddress();
|
||||
}
|
||||
|
|
@ -27,8 +27,11 @@ public interface RpcProvider extends TransportMultiplexier {
|
|||
void registerRpcServiceEndpoint(RpcServiceEndpoint rpcEndpoint);
|
||||
void unregisteRpcServiceEndpoint(RpcServiceEndpoint rpcEndpoint);
|
||||
|
||||
RpcClientCall newCall(TransportEndpoint sourceEndpoint, RpcAddressable targetAddress);
|
||||
RpcClientCall newCall(TransportEndpoint sourceEndpoint, String targetAddress);
|
||||
|
||||
RpcClientCall newCall(String targetAddress);
|
||||
RpcClientCall newCall(RpcAddressable targetAddress);
|
||||
|
||||
void registerCall(RpcClientCall call);
|
||||
void cancelCall(RpcClientCall call);
|
||||
|
|
|
|||
|
|
@ -92,6 +92,17 @@ public class RpcProviderImpl implements RpcProvider {
|
|||
|
||||
return call;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RpcClientCall newCall(TransportEndpoint sourceEndpoint, RpcAddressable targetAddress) {
|
||||
long callTag = getNextCallTag();
|
||||
RpcClientCallImpl call = new RpcClientCallImpl(this);
|
||||
call.setSourceAddress(sourceEndpoint.getEndpointAddress());
|
||||
call.setTargetAddress(targetAddress.getAddress());
|
||||
call.setCallTag(callTag);
|
||||
|
||||
return call;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RpcClientCall newCall(String targetAddress) {
|
||||
|
|
@ -100,6 +111,12 @@ public class RpcProviderImpl implements RpcProvider {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RpcClientCall newCall(RpcAddressable targetAddress) {
|
||||
return newCall(targetAddress.getAddress());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerCall(RpcClientCall call) {
|
||||
assert(call != null);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,21 @@
|
|||
/*
|
||||
* 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 ClientOnlyEventDrivenStyle {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,21 @@
|
|||
/*
|
||||
* 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 ClientOnlyListenerStyle {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,21 @@
|
|||
/*
|
||||
* 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;
|
||||
|
||||
@OnwireName(name="TestCommand")
|
||||
|
|
|
|||
Loading…
Reference in New Issue