Search in sources :

Example 1 with OrderedExecutor

use of org.onlab.util.OrderedExecutor 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)

Example 2 with OrderedExecutor

use of org.onlab.util.OrderedExecutor in project onos by opennetworkinglab.

the class MastershipProxyManager 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) Tools(org.onlab.util.Tools) LoggerFactory(org.slf4j.LoggerFactory) Tools.groupedThreads(org.onlab.util.Tools.groupedThreads) CompletableFuture(java.util.concurrent.CompletableFuture) Function(java.util.function.Function) MastershipProxyService(org.onosproject.mastership.MastershipProxyService) 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) KryoNamespaces(org.onosproject.store.serializers.KryoNamespaces) MastershipService(org.onosproject.mastership.MastershipService) Method(java.lang.reflect.Method) ExecutorService(java.util.concurrent.ExecutorService) NodeId(org.onosproject.cluster.NodeId) Serializer(org.onosproject.store.service.Serializer) ImmutableSet(com.google.common.collect.ImmutableSet) Logger(org.slf4j.Logger) Executor(java.util.concurrent.Executor) Deactivate(org.osgi.service.component.annotations.Deactivate) Set(java.util.Set) CompletionException(java.util.concurrent.CompletionException) MastershipProxyFactory(org.onosproject.mastership.MastershipProxyFactory) Maps(com.google.common.collect.Maps) Executors(java.util.concurrent.Executors) ReferenceCardinality(org.osgi.service.component.annotations.ReferenceCardinality) Objects(java.util.Objects) OrderedExecutor(org.onlab.util.OrderedExecutor) ClusterCommunicationService(org.onosproject.store.cluster.messaging.ClusterCommunicationService) ClusterService(org.onosproject.cluster.ClusterService) DeviceId(org.onosproject.net.DeviceId) Reference(org.osgi.service.component.annotations.Reference) Executor(java.util.concurrent.Executor) OrderedExecutor(org.onlab.util.OrderedExecutor) MastershipProxyService(org.onosproject.mastership.MastershipProxyService) OrderedExecutor(org.onlab.util.OrderedExecutor)

Aggregations

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