* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
package org.opendaylight.openflowplugin.impl.statistics.services.compatibility;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
package org.opendaylight.openflowplugin.impl.statistics.services.compatibility;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
import org.opendaylight.openflowplugin.impl.services.AbstractMultipartService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.TransactionId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply;
import org.opendaylight.openflowplugin.impl.services.AbstractMultipartService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.TransactionId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply;
import org.opendaylight.yangtools.yang.binding.Notification;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.yangtools.yang.binding.Notification;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
-public abstract class AbstractCompatibleStatService<I, O, N extends Notification> extends AbstractMultipartService<I> implements BackwardCompatibleAtomicService<I, O> {
+public abstract class AbstractCompatibleStatService<I extends DataContainer, O, N extends Notification> extends
+ AbstractMultipartService<I, MultipartReply> implements BackwardCompatibleAtomicService<I, O> {
private static final Logger LOG = LoggerFactory.getLogger(AbstractCompatibleStatService.class);
private final AtomicLong compatibilityXidSeed;
private final OpenflowVersion ofVersion;
private static final Logger LOG = LoggerFactory.getLogger(AbstractCompatibleStatService.class);
private final AtomicLong compatibilityXidSeed;
private final OpenflowVersion ofVersion;
- public AbstractCompatibleStatService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed) {
+ public AbstractCompatibleStatService(final RequestContextStack requestContextStack,
+ final DeviceContext deviceContext,
+ final AtomicLong compatibilityXidSeed) {
super(requestContextStack, deviceContext);
this.compatibilityXidSeed = compatibilityXidSeed;
ofVersion = OpenflowVersion.get(getVersion());
super(requestContextStack, deviceContext);
this.compatibilityXidSeed = compatibilityXidSeed;
ofVersion = OpenflowVersion.get(getVersion());
- public ListenableFuture<RpcResult<O>> handleAndNotify(final I input, final NotificationPublishService notificationPublishService) {
+ public ListenableFuture<RpcResult<O>> handleAndNotify(final I input,
+ final NotificationPublishService notificationPublishService) {
// hook notification publishing
Futures.addCallback(rpcResultListenableFuture, new FutureCallback<RpcResult<List<MultipartReply>>>() {
@Override
// hook notification publishing
Futures.addCallback(rpcResultListenableFuture, new FutureCallback<RpcResult<List<MultipartReply>>>() {
@Override
if (result != null && result.isSuccessful()) {
// transform rpc result (raw multipart) to notification
final N flowNotification = transformToNotification(result.getResult(), emulatedTxId);
notificationPublishService.offerNotification(flowNotification);
} else {
if (result != null && result.isSuccessful()) {
// transform rpc result (raw multipart) to notification
final N flowNotification = transformToNotification(result.getResult(), emulatedTxId);
notificationPublishService.offerNotification(flowNotification);
} else {
- LOG.debug("compatibility callback failed - NOT emitting notification: {}", input.getClass().getSimpleName());
+ LOG.debug("compatibility callback failed - NOT emitting notification: {}",
+ input.getClass().getSimpleName());
- public void onFailure(Throwable t) {
- LOG.debug("compatibility callback crashed - NOT emitting notification: {}", input.getClass().getSimpleName(), t);
+ public void onFailure(final Throwable throwable) {
+ LOG.debug("compatibility callback crashed - NOT emitting notification: {}",
+ input.getClass().getSimpleName(), throwable);