|
|||||||
| 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.
| Field Summary | |
|---|---|
int |
DEFAULT_COLLECTION_BUFFER_SIZE
|
static 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. |
static String |
PROPERTY_COLLECTION_CACHE_SIZE
|
static String |
PROPERTY_MAX_CONNECTIONS
|
static String |
PROPERTY_MIN_CONNECTIONS
|
static String |
PROPERTY_SHUTDOWN_DELAY
|
static String |
PROPERTY_SYNC_PERIOD
|
| 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. |
DefaultCacheManager |
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. |
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()
|
XMLReaderPool |
getParserPool()
Returns a pool in which the database instance's readers are stored. |
Scheduler |
getScheduler()
Returns the Scheduler |
SecurityManager |
getSecurityManager()
Returns the database instance's security manager |
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. |
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 |
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 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 boolean FORCE_CORRUPTION
public final long DEFAULT_SYNCH_PERIOD
public final long DEFAULT_MAX_SHUTDOWN_WAIT
public final int DEFAULT_COLLECTION_BUFFER_SIZE
| 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(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.
DatabaseConfigurationExceptionpublic 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 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(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 boolean isInitializing()
true is the database instance is being initializedpublic 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 NodeIdFactory getNodeFactory()
public SecurityManager getSecurityManager()
public Scheduler getScheduler()
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 IndexManager getIndexManager()
public XQueryPool getXQueryPool()
public XQueryMonitor getXQueryMonitor()
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 released
public void enterServiceMode(User user)
throws PermissionDeniedException
PermissionDeniedException
public void exitServiceMode(User 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 triggerSync(int syncEvent)
syncEvent - One of Sync.MINOR_SYNC or
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 | ||||||