defer OVSDB port 6640 opening until system is ready
[ovsdb.git] / southbound / southbound-impl / src / main / java / org / opendaylight / ovsdb / southbound / OvsdbMonitorCallback.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. 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.southbound;
9
10 import org.opendaylight.ovsdb.lib.MonitorCallBack;
11 import org.opendaylight.ovsdb.lib.message.TableUpdates;
12 import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
13 import org.opendaylight.ovsdb.southbound.transactions.md.OvsdbOperationalCommandAggregator;
14 import org.opendaylight.ovsdb.southbound.transactions.md.TransactionInvoker;
15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory;
17
18 public class OvsdbMonitorCallback implements MonitorCallBack {
19
20     private static final Logger LOG = LoggerFactory.getLogger(OvsdbMonitorCallback.class);
21     private final InstanceIdentifierCodec instanceIdentifierCodec;
22     private TransactionInvoker txInvoker;
23     private OvsdbConnectionInstance key;
24
25     OvsdbMonitorCallback(InstanceIdentifierCodec instanceIdentifierCodec, OvsdbConnectionInstance key,
26             TransactionInvoker txInvoker) {
27         this.instanceIdentifierCodec = instanceIdentifierCodec;
28         this.txInvoker = txInvoker;
29         this.key = key;
30     }
31
32     @Override
33     public void update(TableUpdates result, DatabaseSchema dbSchema) {
34         txInvoker.invoke(new OvsdbOperationalCommandAggregator(instanceIdentifierCodec, key, result, dbSchema));
35         LOG.trace("Updated dbSchema: {} and result: {}", dbSchema, result);
36     }
37
38     @Override
39     public void exception(Throwable exception) {
40         LOG.warn("exception {}", exception);
41     }
42
43 }