From d1f18e15d3e93b1f12f6376076b425cce2b691ee Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Tue, 25 Feb 2014 11:12:14 +0100 Subject: [PATCH] RpcRegistration.close() should not throw Closing an RPC registration is an atomic act, e.g. it should never be allowed to throw exceptions. Change-Id: Ie49c67691540db4d4a8a21814e01d3287c5f31cd Signed-off-by: Robert Varga --- .../controller/sal/core/api/Broker.java | 77 ++++++++++--------- 1 file changed, 40 insertions(+), 37 deletions(-) diff --git a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/Broker.java b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/Broker.java index f7c46086e3..6af06255c7 100644 --- a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/Broker.java +++ b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/Broker.java @@ -25,16 +25,16 @@ import org.osgi.framework.BundleContext; /** * Core component of the SAL layer responsible for wiring the SAL consumers. - * + * * The responsibility of the broker is to maintain registration of SAL * functionality {@link Consumer}s and {@link Provider}s, store provider and * consumer specific context and functionality registration via * {@link ConsumerSession} and provide access to infrastructure services, which * removes direct dependencies between providers and consumers. - * - * + * + * *

Infrastructure services

Some examples of infrastructure services: - * + * * - * + * * The services are exposed via session. - * + * *

Session-based access

- * + * * The providers and consumers needs to register in order to use the * binding-independent SAL layer and to expose functionality via SAL layer. - * + * * For more information about session-based access see {@link ConsumerSession} * and {@link ProviderSession} - * - * - * + * + * + * */ public interface Broker { /** * Registers the {@link Consumer}, which will use the SAL layer. - * + * *

* During the registration, the broker obtains the initial functionality * from consumer, using the {@link Consumer#getConsumerFunctionality()}, and * register that functionality into system and concrete infrastructure * services. - * + * *

* Note that consumer could register additional functionality at later point * by using service and functionality specific APIs. - * + * *

* The consumer is required to use returned session for all communication * with broker or one of the broker services. The session is announced to * the consumer by invoking * {@link Consumer#onSessionInitiated(ConsumerSession)}. - * + * * @param cons * Consumer to be registered. * @param context @@ -93,25 +93,25 @@ public interface Broker { /** * Registers the {@link Provider}, which will use the SAL layer. - * + * *

* During the registration, the broker obtains the initial functionality * from consumer, using the {@link Provider#getProviderFunctionality()}, and * register that functionality into system and concrete infrastructure * services. - * + * *

* Note that consumer could register additional functionality at later point * by using service and functionality specific APIs (e.g. * {@link ProviderSession#addRpcImplementation(QName, RpcImplementation)} - * + * *

* The consumer is required to use returned session for all * communication with broker or one of the broker services. The session is * announced to the consumer by invoking * {@link Provider#onSessionInitiated(ProviderSession)}. - * - * + * + * * @param prov * Provider to be registered. * @param context @@ -125,25 +125,25 @@ public interface Broker { /** * {@link Consumer} specific access to the SAL functionality. - * + * *

* ConsumerSession is {@link Consumer}-specific access to the SAL * functionality and infrastructure services. - * + * *

* The session serves to store SAL context (e.g. registration of * functionality) for the consumer and provides access to the SAL * infrastructure services and other functionality provided by * {@link Provider}s. - * - * - * + * + * + * */ public interface ConsumerSession { /** * Sends an RPC to other components registered to the broker. - * + * * @see RpcImplementation * @param rpc * Name of RPC @@ -158,7 +158,7 @@ public interface Broker { /** * Returns a session specific instance (implementation) of requested * service - * + * * @param service * Broker service * @return Session specific implementation of service @@ -167,44 +167,44 @@ public interface Broker { /** * Closes a session between consumer and broker. - * + * *

* The close operation unregisters a consumer and remove all registered * functionality of the consumer from the system. - * + * */ void close(); } /** * {@link Provider} specific access to the SAL functionality. - * + * *

* ProviderSession is {@link Provider}-specific access to the SAL * functionality and infrastructure services, which also allows for exposing * the provider's functionality to the other {@link Consumer}s. - * + * *

* The session serves to store SAL context (e.g. registration of * functionality) for the providers and exposes access to the SAL * infrastructure services, dynamic functionality registration and any other * functionality provided by other {@link Provider}s. - * + * */ public interface ProviderSession extends ConsumerSession { /** * Registers an implementation of the rpc. - * + * *

* The registered rpc functionality will be available to all other * consumers and providers registered to the broker, which are aware of * the {@link QName} assigned to the rpc. - * + * *

* There is no assumption that rpc type is in the set returned by * invoking {@link RpcImplementation#getSupportedRpcs()}. This allows * for dynamic rpc implementations. - * + * * @param rpcType * Name of Rpc * @param implementation @@ -221,7 +221,7 @@ public interface Broker { /** * Closes a session between provider and SAL. - * + * *

* The close operation unregisters a provider and remove all registered * functionality of the provider from the system. @@ -233,12 +233,15 @@ public interface Broker { boolean isClosed(); Set getSupportedRpcs(); - + ListenerRegistration addRpcRegistrationListener(RpcRegistrationListener listener); } public interface RpcRegistration extends Registration { QName getType(); + + @Override + void close(); } public interface RoutedRpcRegistration extends RpcRegistration, -- 2.36.6