Bug 8055: use method references instead of lambdas
[ovsdb.git] / hwvtepsouthbound / hwvtepsouthbound-impl / src / main / java / org / opendaylight / ovsdb / hwvtepsouthbound / HwvtepMonitorCallback.java
1 /*
2  * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.ovsdb.hwvtepsouthbound;
9
10 import org.opendaylight.ovsdb.hwvtepsouthbound.transactions.md.HwvtepOperationalCommandAggregator;
11 import org.opendaylight.ovsdb.hwvtepsouthbound.transactions.md.TransactionInvoker;
12 import org.opendaylight.ovsdb.lib.MonitorCallBack;
13 import org.opendaylight.ovsdb.lib.message.TableUpdates;
14 import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory;
17
18 public class HwvtepMonitorCallback implements MonitorCallBack {
19
20     private static final Logger LOG = LoggerFactory.getLogger(HwvtepMonitorCallback.class);
21     private HwvtepConnectionInstance key;
22     private TransactionInvoker txInvoker;
23
24     HwvtepMonitorCallback(HwvtepConnectionInstance key,TransactionInvoker txInvoker) {
25         this.txInvoker = txInvoker;
26         this.key = key;
27     }
28
29     @Override
30     public void update(TableUpdates result, DatabaseSchema dbSchema) {
31         LOG.trace("result: {} dbSchema: {}",result,dbSchema.getName());
32         txInvoker.invoke(new HwvtepOperationalCommandAggregator(key, result, dbSchema));
33         LOG.trace("update exit");
34     }
35
36     @Override
37     public void exception(Throwable exception) {
38         LOG.warn("exception {}", exception);
39     }
40
41 }