|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.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.
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. |
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(String instanceName,
int minBrokers,
int maxBrokers,
Configuration config)
Creates and configures a database instance and adds it to the pool. |
void |
enterServiceMode(User user)
|
void |
exitServiceMode(User user)
|
DBBroker |
get(User user)
Returns an active broker for the database instance. |
Map |
getActiveBrokers()
|
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. |
Lock |
getGlobalUpdateLock()
Returns the global update lock for the database instance. |
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(String instanceName)
Returns a broker pool for a database instance. |
static Iterator |
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. |
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 |
SymbolTable |
getSymbols()
|
TransactionManager |
getTransactionManager()
|
XQueryPool |
getXQueryPool()
Returns a pool in which the database instance's compiled XQueries are stored. |
static boolean |
isConfigured()
Returns whether or not the default database instance is configured. |
static boolean |
isConfigured(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. |
boolean |
isReadOnly()
|
boolean |
isShuttingDown()
|
boolean |
isTransactional()
Returns whether transactions can be handled by the database instance. |
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(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 |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_INSTANCE_NAME
public static final String CONFIGURATION_CONNECTION_ELEMENT_NAME
public static final String CONFIGURATION_POOL_ELEMENT_NAME
public static final String CONFIGURATION_SECURITY_ELEMENT_NAME
public static final String CONFIGURATION_RECOVERY_ELEMENT_NAME
public static final String DATA_DIR_ATTRIBUTE
public static final String RECOVERY_ENABLED_ATTRIBUTE
public static final String RECOVERY_POST_RECOVERY_CHECK
public static final String COLLECTION_CACHE_SIZE_ATTRIBUTE
public static final String MIN_CONNECTIONS_ATTRIBUTE
public static final String MAX_CONNECTIONS_ATTRIBUTE
public static final String SYNC_PERIOD_ATTRIBUTE
public static final String SHUTDOWN_DELAY_ATTRIBUTE
public static final String PROPERTY_DATA_DIR
public static final String PROPERTY_MIN_CONNECTIONS
public static final String PROPERTY_MAX_CONNECTIONS
public static final String PROPERTY_SYNC_PERIOD
public static final String PROPERTY_SHUTDOWN_DELAY
public static final String PROPERTY_COLLECTION_CACHE_SIZE
public static final String DEFAULT_SECURITY_CLASS
public static final String PROPERTY_SECURITY_CLASS
public static final String PROPERTY_RECOVERY_ENABLED
public static final String PROPERTY_RECOVERY_CHECK
public static final String PROPERTY_SYSTEM_TASK_CONFIG
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 String PROPERTY_PAGE_SIZE
public static final int DEFAULT_PAGE_SIZE
Method Detail |
---|
public static final void setRegisterShutdownHook(boolean register)
register
- true
if the JVM should run the threadpublic 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(String instanceName, int minBrokers, int maxBrokers, Configuration config) throws EXistException, DatabaseConfigurationException
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.
DatabaseConfigurationException
public static final boolean isConfigured()
true
if it is configuredpublic static final boolean isConfigured(String id)
id
- The name of the database instance
true
if it is configuredpublic 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(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 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(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 long getReservedMem()
public int getPageSize()
public boolean isInitializing()
true
is the database instance is being initializedpublic String getId()
public int active()
public Map getActiveBrokers()
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 NodeIdFactory getNodeFactory()
public SecurityManager getSecurityManager()
public Scheduler getScheduler()
public SymbolTable getSymbols()
public NotificationService getNotificationService()
public boolean isTransactional()
true
if transactions can be handledpublic boolean isReadOnly()
public boolean isInServiceMode()
public TransactionManager getTransactionManager()
public CollectionConfigurationManager getConfigurationManager()
public CollectionCache getCollectionsCache()
public DefaultCacheManager getCacheManager()
public CollectionCacheManager getCollectionCacheMgr()
public IndexManager getIndexManager()
public XQueryPool getXQueryPool()
public ProcessMonitor getProcessMonitor()
public XMLReaderPool getParserPool()
public Lock getGlobalUpdateLock()
public DBBroker get(User user) throws EXistException
EXistException
- If the instance is not available (stopped or not configured)public void release(DBBroker broker)
broker
- The broker to be releasedpublic void enterServiceMode(User user) throws PermissionDeniedException
PermissionDeniedException
public void exitServiceMode(User user) throws PermissionDeniedException
PermissionDeniedException
public 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 triggerSync(int syncEvent)
syncEvent
- One of Sync.MINOR_SYNC
or
Sync.MINOR_SYNC
public void triggerSystemTask(SystemTask task)
task
- The taskpublic void shutdown()
public boolean isShuttingDown()
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 |