|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.eigenbase.util.CompoundClosableAllocation
net.sf.farrago.util.FarragoCompoundAllocation
net.sf.farrago.db.FarragoDbSingleton
public abstract class FarragoDbSingleton
FarragoDbSingleton manages a singleton instance of FarragoDatabase. It is reference-counted to allow it to be shared in a library environment such as the directly embedded JDBC driver. Note that all synchronization is done at the class level, not the object level.
| Field Summary | |
|---|---|
private static boolean |
backupInProgress
Flag indicating whether a database backup is already in progress |
private static boolean |
inShutdown
Flag indicating whether FarragoDbSingleton is already in shutdown(), to help prevent recursive shutdown. |
private static boolean |
inShutdownConditional
Flag indicating whether FarragoDbSingleton is already in shutdownConditional(int), to help prevent recursive shutdown. |
protected static FarragoDatabase |
instance
Singleton instance, or null when nReferences == 0. |
private static int |
nReferences
Reference count. |
protected static Logger |
tracer
|
| Fields inherited from class org.eigenbase.util.CompoundClosableAllocation |
|---|
allocations |
| Constructor Summary | |
|---|---|
FarragoDbSingleton()
|
|
| Method Summary | |
|---|---|
(package private) static void |
addSession(FarragoDatabase db,
FarragoDbSession session)
|
private static int |
countLoopbackSessions()
|
(package private) static void |
disconnectSession(FarragoDbSession session)
|
static List<FarragoSession> |
getSessions()
|
static List<FarragoSession> |
getSessions(FarragoDatabase db)
Retrieve a list of connected FarragoSession objects. |
static boolean |
isReferenced()
|
static FarragoDatabase |
pinReference(FarragoSessionFactory sessionFactory)
Establishes a database reference. |
static FarragoDatabase |
pinReference(FarragoSessionFactory sessionFactory,
boolean requireExistingEngine)
Establishes a database reference. |
static boolean |
setBackupFlag(boolean inProgress)
Sets a flag indicating whether a backup is in progress. |
static void |
shutdown()
Shuts down the database, killing any running sessions. |
static boolean |
shutdownConditional(int groundReferences)
Conditionally shuts down the database depending on the number of references. |
| Methods inherited from class org.eigenbase.util.CompoundClosableAllocation |
|---|
addAllocation, closeAllocation, forgetAllocation, hasAllocations |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.eigenbase.util.ClosableAllocationOwner |
|---|
addAllocation |
| Methods inherited from interface org.eigenbase.util.ClosableAllocation |
|---|
closeAllocation |
| Methods inherited from interface org.eigenbase.util.ClosableAllocation |
|---|
closeAllocation |
| Field Detail |
|---|
protected static final Logger tracer
private static int nReferences
protected static FarragoDatabase instance
private static boolean inShutdown
shutdown(), to help prevent recursive shutdown.
private static boolean backupInProgress
private static boolean inShutdownConditional
shutdownConditional(int), to help prevent recursive shutdown.
| Constructor Detail |
|---|
public FarragoDbSingleton()
| Method Detail |
|---|
public static FarragoDatabase pinReference(FarragoSessionFactory sessionFactory)
sessionFactory - factory for various database-level objects
public static FarragoDatabase pinReference(FarragoSessionFactory sessionFactory,
boolean requireExistingEngine)
sessionFactory - factory for various database-level objectsrequireExistingEngine - true if require an already created reference
static void addSession(FarragoDatabase db,
FarragoDbSession session)
static void disconnectSession(FarragoDbSession session)
public static List<FarragoSession> getSessions(FarragoDatabase db)
The returned FarragoSession objects may be disconnected at any time.
See FarragoSession.isClosed().
db - sessions are retrieved from this FarragoDatabase instance
public static List<FarragoSession> getSessions()
public static boolean shutdownConditional(int groundReferences)
groundReferences - threshold for shutdown; if actual number of
sessions is greater than this, no shutdown takes place
public static void shutdown()
private static int countLoopbackSessions()
public static boolean isReferenced()
public static boolean setBackupFlag(boolean inProgress)
inProgress - true if the flag is to be set, indicating that a backup
is in progress
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||