Package com.tailf.dp
Class DpTrans
- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
DpActionTrans
,DpValidateTrans
The transaction context.
Each transaction is running in separate thread.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Method Summary
Modifier and TypeMethodDescriptionReturns an iterator for the accumulated objects.void
dataSetTimeout
(int timeoutSeconds) A data callback should normally complete "quickly", since e.g.int
The database name.int
for ConfM The device type (needs to be public since access from Maapi package)int
getDevNo()
for ConfM The device number (needs to be public since access from Maapi package)getDp()
Return the data provider (DP) instance that this transaction belongs to.int
getMode()
The mode.Returns the namespace list stored by the data provider.If the tailf:opaque substatement has been used with the tailf:callpoint statement in the data model, the argument string is made available to the callbacks via this methodlong
Secondary index.Return the worker socketsocket
.int
Return the current transaction handle.Get method for User owned opaque data.The user information.void
honorFilter
(boolean h) Tell the server whether the currently requested filtering is being honored or not.boolean
hideInactive flag.void
run()
Runs the thread.void
A possibility to give a specified worker socket for the transaction.void
setTransactionUserOpaque
(Object opaque) Set method for User owned opaque data.Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
Method Details
-
getDp
Return the data provider (DP) instance that this transaction belongs to.- Returns:
- Data provider instance
-
getTransaction
public int getTransaction()Return the current transaction handle.- Returns:
- transaction handle
-
getSocket
Return the worker socketsocket
. A default is allocated byDp
, but this can be changed with setSocket from the init callback (e.g before the socket is connected to Conf) -
getMode
public int getMode()The mode. Is always either Conf.MODE_READ or Conf.MODE_READ_WRITE -
getDBName
public int getDBName()The database name. Is always either of: -
getUserInfo
The user information. -
getTransactionUserOpaque
Get method for User owned opaque data. This field is meant to be used by the user so that we easily can pass data between our Data callbacks and out transaction callbacks. Typically in the Transaction init() callback, we open a database handle which is the later used by the various DataProvider callbacks such as getElem() and setElem() -
setTransactionUserOpaque
Set method for User owned opaque data. This field is meant to be used by the user so that we easily can pass data between our Data callbacks and our transaction callbacks. Typically in the Transaction init() callback, we open a database handle which is the later used by the various DataProvider callbacks such as getElem() and setElem()- Parameters:
opaque
-
-
getOpaque
If the tailf:opaque substatement has been used with the tailf:callpoint statement in the data model, the argument string is made available to the callbacks via this method -
getSecondaryIndex
public long getSecondaryIndex()Secondary index. When specified in get-next operations the provider needs to sort objects on this named secondary-index. -
isHideInactive
public boolean isHideInactive()hideInactive flag. Set to true if inactive element is not present. -
getDevNo
public int getDevNo()for ConfM The device number (needs to be public since access from Maapi package) -
getDeviceType
public int getDeviceType()for ConfM The device type (needs to be public since access from Maapi package) -
setSocket
A possibility to give a specified worker socket for the transaction. The default worker socket is otherwise allocated by Dp when the transaction is created. Only use this method from within the DpTransCallback.init() method.If this option is used the Socket needs to be connected to ConfD/NCS.
- Parameters:
sock
- A socket connected to ConfD/NCS.
-
getWorkerSocket
-
honorFilter
public void honorFilter(boolean h) Tell the server whether the currently requested filtering is being honored or not. Only use this method from within one of the DpDataCallback.iterator() methods. If this method is not called, the server will assume that the filter was not honored.- Parameters:
h
- whether or not the filter is being honored
-
run
public void run()Runs the thread. -
getNsList
Returns the namespace list stored by the data provider. -
accumulated
Returns an iterator for the accumulated objects. -
dataSetTimeout
A data callback should normally complete "quickly", since e.g. the execution of a show command in the CLI may require many data callback invocations. Thus it should be possible to set the /confdConfig/capi/queryTimeout in confd.conf such that it covers the longest possible execution time for any data callback. In some rare cases it may still be necessary for a data callback to have a longer execution time, and then this function can be used to extend (or shorten) the timeout for the current callback invocation. The timeout is given in seconds from the point in time when the function is called.- Parameters:
timeoutSeconds
- timeout in seconds- Throws:
IOException
DpCallbackException
-