|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.Observable
org.exist.storage.BrokerPool
public class BrokerPool
This class controls all available instances of the database.
Use it to configure, start and stop database instances.
You may have multiple instances defined, each using its own configuration.
To define multiple instances, pass an identification string to configure(String, int, int, Configuration)
and use getInstance(String) to retrieve an instance.
| Field Summary | |
|---|---|
static java.lang.String |
COLLECTION_CACHE_SIZE_ATTRIBUTE
|
protected CollectionCache |
collectionCache
The cache in which the database instance's collections are stored. |
protected Configuration |
conf
The configuration object for the database instance |
static java.lang.String |
CONFIGURATION_CONNECTION_ELEMENT_NAME
|
static java.lang.String |
CONFIGURATION_POOL_ELEMENT_NAME
|
static java.lang.String |
CONFIGURATION_RECOVERY_ELEMENT_NAME
|
static java.lang.String |
CONFIGURATION_SECURITY_ELEMENT_NAME
|
static java.lang.String |
DATA_DIR_ATTRIBUTE
|
int |
DEFAULT_COLLECTION_BUFFER_SIZE
|
static java.lang.String |
DEFAULT_INSTANCE_NAME
The name of a default database instance for those who are too lazy to provide parameters ;-). |
long |
DEFAULT_MAX_SHUTDOWN_WAIT
|
static int |
DEFAULT_PAGE_SIZE
|
static java.lang.String |
DEFAULT_SECURITY_CLASS
|
long |
DEFAULT_SYNCH_PERIOD
|
static java.lang.String |
DOC_ID_MODE_ATTRIBUTE
|
static java.lang.String |
DOC_ID_MODE_PROPERTY
|
static boolean |
FORCE_CORRUPTION
For testing only: triggers a database corruption by disabling the page caches. |
static java.lang.String |
MAX_CONNECTIONS_ATTRIBUTE
|
static java.lang.String |
MIN_CONNECTIONS_ATTRIBUTE
|
static java.lang.String |
NODES_BUFFER_ATTRIBUTE
|
static java.lang.String |
PROPERTY_COLLECTION_CACHE_SIZE
|
static java.lang.String |
PROPERTY_DATA_DIR
|
static java.lang.String |
PROPERTY_MAX_CONNECTIONS
|
static java.lang.String |
PROPERTY_MIN_CONNECTIONS
|
static java.lang.String |
PROPERTY_NODES_BUFFER
|
static java.lang.String |
PROPERTY_PAGE_SIZE
|
static java.lang.String |
PROPERTY_RECOVERY_CHECK
|
static java.lang.String |
PROPERTY_RECOVERY_ENABLED
|
static java.lang.String |
PROPERTY_SECURITY_CLASS
|
static java.lang.String |
PROPERTY_SHUTDOWN_DELAY
|
static java.lang.String |
PROPERTY_SYNC_PERIOD
|
static java.lang.String |
PROPERTY_SYSTEM_TASK_CONFIG
|
static java.lang.String |
RECOVERY_ENABLED_ATTRIBUTE
|
static java.lang.String |
RECOVERY_POST_RECOVERY_CHECK
|
static java.lang.String |
SHUTDOWN_DELAY_ATTRIBUTE
|
static java.lang.String |
SIGNAL_READINESS
ready for recovery & read-only operations |
static java.lang.String |
SIGNAL_RIDEABLE
ready for writable operations |
static java.lang.String |
SIGNAL_SHUTDOWN
running shutdown sequence |
static java.lang.String |
SIGNAL_STARTUP
initializing subcomponents |
static java.lang.String |
SYNC_PERIOD_ATTRIBUTE
|
protected XMLReaderPool |
xmlReaderPool
The pool in which the database instance's readers are stored. |
| Method Summary | |
|---|---|
int |
active()
Returns the number of brokers currently serving requests for the database instance. |
int |
available()
Returns the number of inactive brokers for the database instance. |
protected boolean |
canReadDataDir(Configuration conf)
|
static void |
configure(int minBrokers,
int maxBrokers,
Configuration config)
Creates and configures a default database instance and adds it to the pool. |
static void |
configure(java.lang.String instanceName,
int minBrokers,
int maxBrokers,
Configuration config)
Creates and configures a database instance and adds it to the pool. |
protected DBBroker |
createBroker()
Creates an inactive broker for the database instance. |
DBBroker |
enterServiceMode(Subject user)
|
void |
exitServiceMode(Subject user)
|
DBBroker |
get(Subject user)
Returns an active broker for the database instance. |
DBBroker |
getActiveBroker()
|
java.util.Map<java.lang.Thread,DBBroker> |
getActiveBrokers()
|
DBBroker |
getBroker()
|
DefaultCacheManager |
getCacheManager()
Returns a cache in which the database instance's may store items. |
CollectionCacheManager |
getCollectionCacheMgr()
|
CollectionCache |
getCollectionsCache()
Returns a cache in which the database instance's collections are stored. |
Configuration |
getConfiguration()
Returns the configuration object for the database instance. |
CollectionConfigurationManager |
getConfigurationManager()
Returns a manager for accessing the database instance's collection configuration files. |
Debuggee |
getDebuggee()
|
Lock |
getGlobalUpdateLock()
Returns the global update lock for the database instance. |
java.lang.String |
getId()
Returns the database instance's name. |
IndexManager |
getIndexManager()
Returns the index manager which handles all additional indexes not being part of the database core. |
static BrokerPool |
getInstance()
Returns a broker pool for the default database instance. |
static BrokerPool |
getInstance(java.lang.String instanceName)
Returns a broker pool for a database instance. |
static java.util.Iterator<BrokerPool> |
getInstances()
Returns an iterator over the database instances. |
long |
getLastMajorSync()
|
long |
getMajorSyncPeriod()
|
int |
getMax()
Returns the maximal number of brokers for the database instance. |
NodeIdFactory |
getNodeFactory()
|
NotificationService |
getNotificationService()
|
int |
getPageSize()
|
XMLReaderPool |
getParserPool()
Returns a pool in which the database instance's readers are stored. |
PerformanceStats |
getPerformanceStats()
Returns the global profiler used to gather execution statistics from all XQueries running on this db instance. |
ProcessMonitor |
getProcessMonitor()
Returns a monitor in which the database instance's running XQueries are managed. |
long |
getReservedMem()
|
Scheduler |
getScheduler()
Returns the Scheduler |
SecurityManager |
getSecurityManager()
Returns the database instance's security manager |
java.util.Calendar |
getStartupTime()
|
Subject |
getSubject()
|
SymbolTable |
getSymbols()
|
TransactionManager |
getTransactionManager()
|
BrokerWatchdog |
getWatchdog()
|
XQueryPool |
getXQueryPool()
Returns a pool in which the database instance's compiled XQueries are stored. |
protected void |
initialize()
Initializes the database instance. |
static boolean |
isConfigured()
Returns whether or not the default database instance is configured. |
static boolean |
isConfigured(java.lang.String id)
Returns whether or not a database instance is configured. |
boolean |
isInitializing()
Whether or not the database instance is being initialized. |
boolean |
isInServiceMode()
|
boolean |
isInstanceConfigured()
Returns whether the database instance has been configured. |
static boolean |
isInstancesEmpty()
|
boolean |
isReadOnly()
|
boolean |
isShuttingDown()
|
boolean |
isTransactional()
Returns whether transactions can be handled by the database instance. |
void |
printSystemInfo()
|
void |
registerShutdownListener(ShutdownListener listener)
|
static void |
registerStatusObserver(java.util.Observer observer)
|
void |
release(DBBroker broker)
Releases a broker for the database instance. |
void |
reloadSecurityManager(DBBroker broker)
Reloads the security manager of the database instance. |
void |
setReadOnly()
|
static void |
setRegisterShutdownHook(boolean register)
Whether of not the JVM should run the shutdown thread. |
boolean |
setSubject(Subject subject)
|
void |
shutdown()
Shuts downs the database instance |
void |
shutdown(boolean killed)
Shuts downs the database instance |
void |
signalSystemStatus(java.lang.String signal)
|
static void |
stop()
Stops the default database instance. |
static void |
stop(java.lang.String id)
Stops the given database instance. |
static void |
stopAll(boolean killed)
Stops all the database instances. |
void |
sync(DBBroker broker,
int syncEvent)
Executes a waiting cache synchronization for the database instance. |
static void |
systemInfo()
|
int |
total()
|
void |
triggerCheckpoint()
|
void |
triggerSync(int syncEvent)
Schedules a cache synchronization for the database instance. |
void |
triggerSystemTask(SystemTask task)
Schedules a system maintenance task for the database instance. |
| Methods inherited from class java.util.Observable |
|---|
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.exist.Database |
|---|
addObserver |
| Field Detail |
|---|
public static final java.lang.String SIGNAL_STARTUP
public static final java.lang.String SIGNAL_READINESS
public static final java.lang.String SIGNAL_RIDEABLE
public static final java.lang.String SIGNAL_SHUTDOWN
public static final java.lang.String DEFAULT_INSTANCE_NAME
public static final java.lang.String CONFIGURATION_CONNECTION_ELEMENT_NAME
public static final java.lang.String CONFIGURATION_POOL_ELEMENT_NAME
public static final java.lang.String CONFIGURATION_SECURITY_ELEMENT_NAME
public static final java.lang.String CONFIGURATION_RECOVERY_ELEMENT_NAME
public static final java.lang.String DATA_DIR_ATTRIBUTE
public static final java.lang.String RECOVERY_ENABLED_ATTRIBUTE
public static final java.lang.String RECOVERY_POST_RECOVERY_CHECK
public static final java.lang.String COLLECTION_CACHE_SIZE_ATTRIBUTE
public static final java.lang.String MIN_CONNECTIONS_ATTRIBUTE
public static final java.lang.String MAX_CONNECTIONS_ATTRIBUTE
public static final java.lang.String SYNC_PERIOD_ATTRIBUTE
public static final java.lang.String SHUTDOWN_DELAY_ATTRIBUTE
public static final java.lang.String NODES_BUFFER_ATTRIBUTE
public static final java.lang.String PROPERTY_DATA_DIR
public static final java.lang.String PROPERTY_MIN_CONNECTIONS
public static final java.lang.String PROPERTY_MAX_CONNECTIONS
public static final java.lang.String PROPERTY_SYNC_PERIOD
public static final java.lang.String PROPERTY_SHUTDOWN_DELAY
public static final java.lang.String PROPERTY_COLLECTION_CACHE_SIZE
public static final java.lang.String DEFAULT_SECURITY_CLASS
public static final java.lang.String PROPERTY_SECURITY_CLASS
public static final java.lang.String PROPERTY_RECOVERY_ENABLED
public static final java.lang.String PROPERTY_RECOVERY_CHECK
public static final java.lang.String PROPERTY_SYSTEM_TASK_CONFIG
public static final java.lang.String PROPERTY_NODES_BUFFER
public static final java.lang.String DOC_ID_MODE_ATTRIBUTE
public static final java.lang.String DOC_ID_MODE_PROPERTY
public static boolean FORCE_CORRUPTION
public final long DEFAULT_SYNCH_PERIOD
public final long DEFAULT_MAX_SHUTDOWN_WAIT
public final int DEFAULT_COLLECTION_BUFFER_SIZE
public static final java.lang.String PROPERTY_PAGE_SIZE
public static final int DEFAULT_PAGE_SIZE
protected Configuration conf
protected CollectionCache collectionCache
protected XMLReaderPool xmlReaderPool
| Method Detail |
|---|
public static final void setRegisterShutdownHook(boolean register)
register - true if the JVM should run the thread
public static final void configure(int minBrokers,
int maxBrokers,
Configuration config)
throws EXistException,
DatabaseConfigurationException
minBrokers - The minimum number of concurrent brokers for handling requests on the database instance.maxBrokers - The maximum number of concurrent brokers for handling requests on the database instance.config - The configuration object for the database instance
EXistException
EXistException - If the initialization fails.
DatabaseConfigurationException
public static final void configure(java.lang.String instanceName,
int minBrokers,
int maxBrokers,
Configuration config)
throws EXistException
instanceName - A unique name for the database instance.
It is possible to have more than one database instance (with different configurations for example).minBrokers - The minimum number of concurrent brokers for handling requests on the database instance.maxBrokers - The maximum number of concurrent brokers for handling requests on the database instance.config - The configuration object for the database instance
EXistException - If the initialization fails.public static final boolean isConfigured()
true if it is configuredpublic static final boolean isConfigured(java.lang.String id)
id - The name of the database instance
true if it is configured
public static final BrokerPool getInstance()
throws EXistException
EXistException - If the database instance is not available (not created, stopped or not configured)
public static final BrokerPool getInstance(java.lang.String instanceName)
throws EXistException
instanceName - The name of the database instance
EXistException - If the instance is not available (not created, stopped or not configured)public static final java.util.Iterator<BrokerPool> getInstances()
public static final boolean isInstancesEmpty()
public static final void stop()
throws EXistException
EXistException - If the default database instance is not available (not created, stopped or not configured)
public static final void stop(java.lang.String id)
throws EXistException
id - The name of the database instance
EXistException - If the database instance is not available (not created, stopped or not configured)public static final void stopAll(boolean killed)
killed - true when invoked by an exiting JVMpublic static final void systemInfo()
public static void registerStatusObserver(java.util.Observer observer)
protected boolean canReadDataDir(Configuration conf)
throws EXistException
EXistException
protected void initialize()
throws EXistException,
DatabaseConfigurationException
EXistException
DatabaseConfigurationExceptionpublic long getReservedMem()
public int getPageSize()
public void signalSystemStatus(java.lang.String signal)
public boolean isInitializing()
true is the database instance is being initializedpublic java.lang.String getId()
getId in interface Databasepublic int active()
public java.util.Map<java.lang.Thread,DBBroker> getActiveBrokers()
public int available()
public int getMax()
public int total()
public final boolean isInstanceConfigured()
true if the datbase instance is configuredpublic Configuration getConfiguration()
getConfiguration in interface Databasepublic void registerShutdownListener(ShutdownListener listener)
public NodeIdFactory getNodeFactory()
getNodeFactory in interface Databasepublic SecurityManager getSecurityManager()
getSecurityManager in interface Databasepublic Scheduler getScheduler()
public SymbolTable getSymbols()
public NotificationService getNotificationService()
public boolean isTransactional()
true if transactions can be handledpublic boolean isReadOnly()
public void setReadOnly()
public boolean isInServiceMode()
public TransactionManager getTransactionManager()
getTransactionManager in interface Databasepublic CollectionConfigurationManager getConfigurationManager()
public CollectionCache getCollectionsCache()
public DefaultCacheManager getCacheManager()
getCacheManager in interface Databasepublic CollectionCacheManager getCollectionCacheMgr()
public IndexManager getIndexManager()
getIndexManager in interface Databasepublic XQueryPool getXQueryPool()
public ProcessMonitor getProcessMonitor()
public PerformanceStats getPerformanceStats()
getPerformanceStats in interface Databasepublic XMLReaderPool getParserPool()
public Lock getGlobalUpdateLock()
protected DBBroker createBroker()
throws EXistException
EXistExceptionpublic boolean setSubject(Subject subject)
setSubject in interface Databasepublic Subject getSubject()
getSubject in interface Databasepublic DBBroker getActiveBroker()
getActiveBroker in interface Database
public DBBroker getBroker()
throws EXistException
getBroker in interface DatabaseEXistException
public DBBroker get(Subject user)
throws EXistException
get in interface DatabaseEXistException - If the instance is not available (stopped or not configured)public void release(DBBroker broker)
release in interface Databasebroker - The broker to be released
public DBBroker enterServiceMode(Subject user)
throws PermissionDeniedException
PermissionDeniedException
public void exitServiceMode(Subject user)
throws PermissionDeniedException
PermissionDeniedExceptionpublic void reloadSecurityManager(DBBroker broker)
users.xml file has been changed.
broker - A broker responsible for executing the job
TOUNDERSTAND (pb) : why do we need a broker here ? Why not get and
release one when we're done?
WM: this is called from the Collection.store() methods to signal
that /db/system/users.xml has changed.
A broker is already available in these methods, so we use it here.public long getMajorSyncPeriod()
public long getLastMajorSync()
public void sync(DBBroker broker,
int syncEvent)
broker - A broker responsible for executing the jobsyncEvent - One of Sync.MINOR_SYNC or Sync.MINOR_SYNCpublic void triggerSync(int syncEvent)
syncEvent - One of Sync.MINOR_SYNC or
Sync.MINOR_SYNCpublic void triggerSystemTask(SystemTask task)
task - The taskpublic void shutdown()
shutdown in interface Databasepublic boolean isShuttingDown()
public void shutdown(boolean killed)
killed - true when the JVM is (cleanly) exitingpublic BrokerWatchdog getWatchdog()
public void triggerCheckpoint()
public Debuggee getDebuggee()
getDebuggee in interface Databasepublic java.util.Calendar getStartupTime()
public void printSystemInfo()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||