|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.upc.dama.dex.core.Session
public final class Session
A Session is a stateful period of activity of a user with the database engine.
Session
It is established when the user connects to the GraphPool
(GraphPool.newSession()), and it is closed later by the
user when the connection to the GraphPool is no longer required
(Session.close()).
All temporary data obtained within a Session (such as Objects, or
Values, etc) can only be used within that Session, thus they
become invalid if they are used when the Session has been closed.
Specifically, transient attributes just exist whereas the Session where
they were created remain active, that is transient attributes are
automatically removed when the Session is closed
(see Graph.newTransientAttribute(int, short, short)).
Moreover, a Session is exclusive for a thread, thus if it is shared among threads results may be fatal or unexpected.
Transactions
Sessions allow for the management of transactions (Session.beginTx()
and Session.commitTx()). A transaction defines a granurality level
for concurrent execution of Sessions. Thus all operations within a
transaction are considered an execution unit.
By default, if no transactions are defined by the user, all operations behave as autocommit, that is a transaction is created just before each method and closed when the method finishes.
For the moment, transactions has a partial support of the ACID properties.
Transaction type
There are two types of transactions: Read or Shared, and Write or Exclusive. DEX's concurrency model is based in a N-readers 1-writer model, thus read transactions can be executed concurrently whereas write transactions are executed exclusively.
The type of a transaction is defined for the operations it contains. Initially, a transaction starts as a read transaction and just when a method which updates the persistent graph database is found it automatically becomes a write transaction. Obviously, to become a write transaction this must wait until all other read transactions have finished.
| Method Summary | |
|---|---|
void |
beginTx()
Begins a transaction. |
void |
close()
Closes a Session. |
void |
commitTx()
Ends a transaction. |
DbGraph |
getDbGraph()
Gets the DbGraph instance. |
GraphPool |
getGraphPool()
Gets the parent GraphPool instance. |
boolean |
isOpen()
Gets if the Session is open. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public boolean isOpen()
Session is open.
true if the Session is open,
false otherwise.public void close()
close in interface java.io.Closeablepublic GraphPool getGraphPool()
GraphPool instance.
GraphPool instance.public DbGraph getDbGraph()
DbGraph instance.
DbGraph instance.public void beginTx()
public void commitTx()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||