public final class ReadTxContext extends Object implements TxContext
Note that this class is not synchronized.
| Constructor and Description |
|---|
ReadTxContext(VTNManagerProvider provider)
Construct a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addPostSubmitHook(TxHook hook)
This method always throws an exception because transaction post-submit
hook is not supported.
|
void |
addPreSubmitHook(TxHook hook)
This method always throws an exception because transaction pre-submit
hook is not supported.
|
void |
cancelTransaction()
Cancel current transaction for MD-SAL datastore.
|
void |
close()
Close this transaction context.
|
VTNManagerProvider |
getProvider()
Return a
VTNManagerProvider service instance. |
<T> T |
getReadSpecific(Class<T> type)
Return read-only data specific to the current transaction.
|
org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction |
getReadWriteTransaction()
This method always throws an exception because this transaction is
read-only.
|
<T> T |
getSpecific(Class<T> type)
This method always throws an exception because this transaction is
read-only.
|
org.opendaylight.controller.md.sal.binding.api.ReadTransaction |
getTransaction()
Return read-only transaction for MD-SAL datastore.
|
void |
log(org.slf4j.Logger logger,
VTNLogLevel level,
String msg)
Log the specified message.
|
void |
log(org.slf4j.Logger logger,
VTNLogLevel level,
String format,
Object... args)
Log a message according to the specified format string and arguments.
|
void |
log(org.slf4j.Logger logger,
VTNLogLevel level,
String msg,
Throwable t)
Log the specified message and exception.
|
void |
log(org.slf4j.Logger logger,
VTNLogLevel level,
Throwable t,
String format,
Object... args)
Log the specified throwable and a message according to the given
format string and arguments.
|
public ReadTxContext(VTNManagerProvider provider)
provider - A VTNManagerProvider instance.public org.opendaylight.controller.md.sal.binding.api.ReadTransaction getTransaction()
getTransaction in interface TxContextReadTransaction instance.public org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction getReadWriteTransaction()
getReadWriteTransaction in interface TxContextIllegalStateException - Always thrown.public void cancelTransaction()
cancelTransaction in interface TxContextpublic <T> T getReadSpecific(Class<T> type)
If an object specified by the given class is not associated with the current transaction, a new object is instantiated and it is associated with the current transaction. All the transaction specific data will be discarded when the transaction is closed.
getReadSpecific in interface TxContextT - The type of the transaction specific data.type - A class that specifies the type of data.
Note that the class must have a public constructor that
takes one ReadTransaction instance.public <T> T getSpecific(Class<T> type)
getSpecific in interface TxContextT - The type of the transaction specific data.type - A class that specifies the type of data.IllegalStateException - Always thrown.public void addPreSubmitHook(TxHook hook)
addPreSubmitHook in interface TxContexthook - A hook to be invoked when the transaction is going to be
submitted.IllegalStateException - Always thrown.public void addPostSubmitHook(TxHook hook)
addPostSubmitHook in interface TxContexthook - A hook to be invoked after the successful completion of
the transaction.IllegalStateException - Always thrown.public VTNManagerProvider getProvider()
VTNManagerProvider service instance.getProvider in interface TxContextVTNManagerProvider instance.public void log(org.slf4j.Logger logger,
VTNLogLevel level,
String msg)
If the MD-SAL transaction associated with this context is writable, the specified message will be logged when the transaction completes. Note that the specified message will be discarded when the transaction is restarted due to data confliction.
log in interface TxContextlogger - A Logger instance.level - A VTNLogLevel instance that specifies the
logging level.msg - A message to be logged.public void log(org.slf4j.Logger logger,
VTNLogLevel level,
String format,
Object... args)
This method constructs a message using SLF4J log format.
If the MD-SAL transaction associated with this context is writable, the specified message will be logged when the transaction completes. Note that the specified message will be discarded when the transaction is restarted due to data confliction.
log in interface TxContextlogger - A Logger instance.level - A VTNLogLevel instance that specifies the
logging level.format - A format string used to construct log message.args - An object array used to construct log message.public void log(org.slf4j.Logger logger,
VTNLogLevel level,
String msg,
Throwable t)
If the MD-SAL transaction associated with this context is writable, the specified message will be logged when the transaction completes. Note that the specified message will be discarded when the transaction is restarted due to data confliction.
log in interface TxContextlogger - A Logger instance.level - A VTNLogLevel instance that specifies the
logging level.msg - A message to be logged.t - A Throwable to be logged.public void log(org.slf4j.Logger logger,
VTNLogLevel level,
Throwable t,
String format,
Object... args)
Note that this method constructs a log message using
String.format(String, Object[]).
If the MD-SAL transaction associated with this context is writable, the specified message will be logged when the transaction completes. Note that the specified message will be discarded when the transaction is restarted due to data confliction.
log in interface TxContextlogger - A Logger instance.level - A VTNLogLevel instance that specifies the
logging level.t - A Throwable to be logged.format - A format string used to construct log message.args - An object array used to construct log message.public void close()
Note that this method discards unsubmitted data in the transaction.
close in interface AutoCloseableclose in interface TxContextCopyright © 2018 OpenDaylight. All rights reserved.