|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.exist.storage.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 | |
protected CollectionCache |
collectionCache
The cache in which the database instance's collections are stored. |
protected Configuration |
conf
The configuration object for the database instance |
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
|
long |
DEFAULT_SYNCH_PERIOD
|
static boolean |
FORCE_CORRUPTION
For testing only: triggers a database corruption by disabling the page caches. |
protected XMLReaderPool |
xmlReaderPool
The pool in which the database instance's readers are stored. |
| Constructor Summary | |
BrokerPool(java.lang.String instanceName,
int minBrokers,
int maxBrokers,
Configuration conf)
Creates and configures the database instance. |
|
| 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 |
get()
Returns an active broker for the database instance. |
DBBroker |
get(User user)
Returns an active broker for the database instance and sets its current user. |
CacheManager |
getCacheManager()
Returns a cache in which the database instance's may store items. |
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. |
Lock |
getGlobalUpdateLock()
Returns the global update lock for the database instance. |
java.lang.String |
getId()
Returns the database instance's name. |
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 |
getInstances()
Returns an iterator over the database instances. |
int |
getMax()
Returns the maximal number of brokers for the database instance. |
NotificationService |
getNotificationService()
|
XMLReaderPool |
getParserPool()
Returns a pool in which the database instance's readers are stored. |
SecurityManager |
getSecurityManager()
Returns the database instance's security manager |
SyncDaemon |
getSyncDaemon()
Returns the daemon which periodically executes system tasks, including cache synchronization, on the database instance. |
TransactionManager |
getTransactionManager()
|
XQueryMonitor |
getXQueryMonitor()
Returns a monitor in which the database instance's running XQueries are managed. |
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 |
isInstanceConfigured()
Returns whether the database instance has been configured. |
boolean |
isTransactional()
Returns whether transactions can be handled by the database instance. |
protected SecurityManager |
newSecurityManager()
|
void |
registerShutdownListener(ShutdownListener listener)
|
void |
release(DBBroker broker)
Releases a broker for the database instance. |
void |
reloadSecurityManager(DBBroker broker)
Reloads the security manager of the database instance. |
static void |
setRegisterShutdownHook(boolean register)
Whether of not the JVM should run the shutdown thread. |
void |
shutdown()
Shuts downs the database instance |
void |
shutdown(boolean killed)
Shuts downs the database instance |
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 |
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.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String DEFAULT_INSTANCE_NAME
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
protected Configuration conf
protected CollectionCache collectionCache
protected XMLReaderPool xmlReaderPool
| Constructor Detail |
public BrokerPool(java.lang.String instanceName,
int minBrokers,
int maxBrokers,
Configuration conf)
throws EXistException
instanceName - A name for the database instance.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.conf - The configuration object for the database instance
EXistException - If the initialization fails.| 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
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.
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 getInstances()
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 JVM
protected boolean canReadDataDir(Configuration conf)
throws EXistException
EXistExceptionprotected SecurityManager newSecurityManager()
protected void initialize()
throws EXistException
EXistExceptionpublic boolean isInitializing()
true is the database instance is being initializedpublic java.lang.String getId()
public int active()
public int available()
public int getMax()
public final boolean isInstanceConfigured()
true if the datbase instance is configuredpublic Configuration getConfiguration()
public void registerShutdownListener(ShutdownListener listener)
public SecurityManager getSecurityManager()
public SyncDaemon getSyncDaemon()
public NotificationService getNotificationService()
public boolean isTransactional()
true if transactions can be handledpublic TransactionManager getTransactionManager()
public CollectionConfigurationManager getConfigurationManager()
public CollectionCache getCollectionsCache()
public CacheManager getCacheManager()
public XQueryPool getXQueryPool()
public XQueryMonitor getXQueryMonitor()
public XMLReaderPool getParserPool()
public Lock getGlobalUpdateLock()
protected DBBroker createBroker()
throws EXistException
EXistException
public DBBroker get()
throws EXistException
EXistException - If the instance is not available (stopped or not configured)
public DBBroker get(User user)
throws EXistException
user - The user
EXistExceptionpublic void release(DBBroker broker)
broker - The broker to be releasedpublic void reloadSecurityManager(DBBroker broker)
users.xml file has been changed.
public void triggerSync(int syncEvent)
syncEvent - One of org.exist.storage.Sync#MINOR_SYNC or org.exist.storage.Sync#MINOR_SYNCpublic void triggerSystemTask(SystemTask task)
task - The taskpublic void shutdown()
public void shutdown(boolean killed)
killed - true when the JVM is (cleanly) exitingpublic void triggerCheckpoint()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||