2 * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.openflowplugin.impl.services;
10 import com.google.common.util.concurrent.Futures;
11 import com.google.common.util.concurrent.ListenableFuture;
12 import com.google.common.util.concurrent.MoreExecutors;
13 import java.util.function.Function;
14 import org.eclipse.jdt.annotation.NonNull;
15 import org.eclipse.jdt.annotation.Nullable;
16 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
17 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
19 import org.opendaylight.yangtools.yang.binding.DataObject;
20 import org.opendaylight.yangtools.yang.common.RpcResult;
21 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
23 public abstract class AbstractSilentErrorService<I, O extends DataObject>
24 extends AbstractSimpleService<I, O> {
26 protected AbstractSilentErrorService(RequestContextStack requestContextStack,
27 DeviceContext deviceContext,
29 super(requestContextStack, deviceContext, clazz);
33 public ListenableFuture<RpcResult<O>> handleServiceCall(@NonNull I input,
34 @Nullable final Function<OfHeader, Boolean> isComplete) {
35 return Futures.catching(
36 super.handleServiceCall(input, isComplete),
38 t -> RpcResultBuilder.<O>failed().build(), MoreExecutors.directExecutor());