Merge "Bug 6176 - Decrease logging level in Sal-F/G/M-Service and use synchronized...
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / services / PacketProcessingServiceImpl.java
index 348495c44a39792262a32696a78c3a7d17c40764..e32dbb5337d5fcb67703c41b073860740f2d1959 100644 (file)
@@ -12,7 +12,7 @@ import java.util.concurrent.Future;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
 import org.opendaylight.openflowplugin.api.openflow.device.Xid;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.PacketOutConvertor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.PacketOutConvertorData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
@@ -23,8 +23,11 @@ import org.opendaylight.yangtools.yang.common.RpcResult;
 
 public final class PacketProcessingServiceImpl extends AbstractVoidService<TransmitPacketInput> implements PacketProcessingService {
 
-    public PacketProcessingServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext) {
+    private final ConvertorExecutor convertorExecutor;
+
+    public PacketProcessingServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext, final ConvertorExecutor convertorExecutor) {
         super(requestContextStack, deviceContext);
+        this.convertorExecutor = convertorExecutor;
     }
 
     @Override
@@ -33,12 +36,12 @@ public final class PacketProcessingServiceImpl extends AbstractVoidService<Trans
     }
 
     @Override
-    protected OfHeader buildRequest(final Xid xid, final TransmitPacketInput input) {
+    protected OfHeader buildRequest(final Xid xid, final TransmitPacketInput input) throws ServiceException {
         final PacketOutConvertorData data = new PacketOutConvertorData(getVersion());
         data.setDatapathId(getDatapathId());
         data.setXid(xid.getValue());
 
-        final Optional<PacketOutInput> result = ConvertorManager.getInstance().convert(input, data);
+        final Optional<PacketOutInput> result = convertorExecutor.convert(input, data);
         return result.orElse(PacketOutConvertor.defaultResult(getVersion()));
     }
 }