Search in sources :

Example 1 with ProxyService

use of org.onosproject.cluster.ProxyService in project onos by opennetworkinglab.

the class ProxyManager method registerProxyService.

@Override
public <T> void registerProxyService(Class<? super T> type, T instance, Serializer serializer) {
    checkArgument(type.isInterface(), "proxy type must be an interface");
    Executor executor = new OrderedExecutor(proxyServiceExecutor);
    services.computeIfAbsent(type, t -> new ProxyService(instance, t, MESSAGE_PREFIX, (i, m, o) -> new SyncOperationService(i, m, o, serializer, executor), (i, m, o) -> new AsyncOperationService(i, m, o, serializer)));
}
Also used : Proxy(java.lang.reflect.Proxy) ProxyFactory(org.onosproject.cluster.ProxyFactory) LoggerFactory(org.slf4j.LoggerFactory) Tools.groupedThreads(org.onlab.util.Tools.groupedThreads) CompletableFuture(java.util.concurrent.CompletableFuture) Function(java.util.function.Function) ProxyService(org.onosproject.cluster.ProxyService) Component(org.osgi.service.component.annotations.Component) Preconditions.checkArgument(com.google.common.base.Preconditions.checkArgument) Map(java.util.Map) Activate(org.osgi.service.component.annotations.Activate) Method(java.lang.reflect.Method) ExecutorService(java.util.concurrent.ExecutorService) NodeId(org.onosproject.cluster.NodeId) Serializer(org.onosproject.store.service.Serializer) Logger(org.slf4j.Logger) Executor(java.util.concurrent.Executor) Deactivate(org.osgi.service.component.annotations.Deactivate) CompletionException(java.util.concurrent.CompletionException) Maps(com.google.common.collect.Maps) Executors(java.util.concurrent.Executors) ReferenceCardinality(org.osgi.service.component.annotations.ReferenceCardinality) OrderedExecutor(org.onlab.util.OrderedExecutor) ClusterCommunicationService(org.onosproject.store.cluster.messaging.ClusterCommunicationService) Reference(org.osgi.service.component.annotations.Reference) Executor(java.util.concurrent.Executor) OrderedExecutor(org.onlab.util.OrderedExecutor) ProxyService(org.onosproject.cluster.ProxyService) OrderedExecutor(org.onlab.util.OrderedExecutor)

Aggregations

Preconditions.checkArgument (com.google.common.base.Preconditions.checkArgument)1 Maps (com.google.common.collect.Maps)1 Method (java.lang.reflect.Method)1 Proxy (java.lang.reflect.Proxy)1 Map (java.util.Map)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 CompletionException (java.util.concurrent.CompletionException)1 Executor (java.util.concurrent.Executor)1 ExecutorService (java.util.concurrent.ExecutorService)1 Executors (java.util.concurrent.Executors)1 Function (java.util.function.Function)1 OrderedExecutor (org.onlab.util.OrderedExecutor)1 Tools.groupedThreads (org.onlab.util.Tools.groupedThreads)1 NodeId (org.onosproject.cluster.NodeId)1 ProxyFactory (org.onosproject.cluster.ProxyFactory)1 ProxyService (org.onosproject.cluster.ProxyService)1 ClusterCommunicationService (org.onosproject.store.cluster.messaging.ClusterCommunicationService)1 Serializer (org.onosproject.store.service.Serializer)1 Activate (org.osgi.service.component.annotations.Activate)1 Component (org.osgi.service.component.annotations.Component)1