Implementation of
ListenerContainerIF
that uses a reads/write lock to handle concurrency in a safe and
fast way.
Wait (possibly forever) until successful passage.
Record whether current thread may be processing a task
(i.e., has been started and is not in an idle wait).
Number of threads that are not waiting for work *
Add amount to value (i.e., set value += amount)
Insert the specified element at the specified position in this list,
and shift all remaining elements up one position.
Appends the specified element to the end of this list.
Append all of the elements in the specified Collection to the end
of this list, in the order that they are returned by the specified
Collection's Iterator.
Insert all of the elements in the specified Collection at the specified
position in this list, and shift any previous elements upwards as
needed.
Adds a listener that gets called everytime the configuration changes.
Add a listener that monitors each time a connection is made or destroyed.
Add a listener to this container.
By calling this we can keep track of any statements that are
left open when this connection is returned to the pool.
Add a listener that gets called everytime a global Proxool event ocours.
Add a listener that monitors the change of state of the pool (quiet, busy, overloaded, or down)
Add a listener that receives statistics as they are produced
Admin - class org.logicalcobwebs.proxool.admin.
Admin Provides statistics about the performance of a pool.
Use this to admin each pool within Proxool.
Un-prefixed propety name for the Proxool alias configuration property.
Override this method to change to reader preference *
Wait at most msecs to pass; report whether passed.
Name of the attributeDescriptions resource.
Perform some action that returns a result or throws an exception *
Interface for runnable actions that bear results and/or throw Exceptions.
Set the termination status of this task.
Cancel all current prototyping
cancel a house keeper for a pool.
Cancels the timer that outputs the stats
Return the maximum number of elements that can be held.
Main interface for buffers, queues, pipes, conduits, etc.
Set active status of thread t to false, and
then wait until: (a) there is a task in the entry
queue, or (b) other threads are active, or (c) the current
thread is interrupted.
Adjust top and base, and grow DEQ if necessary.
Checks whether we are currently already building too many connections
Remove all of the elements from this list.
Clear the value and exception and set to not-ready,
allowing this FutureResult to be reused.
Return a shallow copy of this FastArrayList
instance.
Doesn't really close the connection, just puts it back in the pool.
Constant for the boolean "close-on-dispose" attribute that signifies
wether or not this configurator shall close the pools it has created
when it is disposed.
Fork both tasks and then wait for their completion.
A specialized expansion of
w.fork(); invoke(v); w.join();
Fork all tasks in array, and await their completion.
Array-based version of coInvoke
Set value to newValue only if it is currently assumedValue.
Set the value to its complement
A
ConnectionListenerIF
that keeps a list of
ConnectionListenerIF
s
and notifies them in a thread safe manner.
A
ProxoolListenerIF
that keeps a list of
ProxoolListenerIF
s
and notifies them in a thread safe manner.
A
StateListenerIF
that keeps a list of
StateListenerIF
s
and notifies them in a thread safe manner.
A
StatisticsListenerIF
that keeps a list of
StatisticsListenerIF
s
and notifies them in a thread safe manner.
Check that all top level elements are named proxool and hand them to
XMLConfigurator
.
Configure Proxool with xml from the given InputSource.
Configure proxool with the given properties.
Configure Proxool with xml from the given reader.
Configure proxool with the given properties file.
Configure Proxool with xml from the given file.
Check under synch lock if DEQ is really empty when doing pop.
double-check a potential take
The url should be of the form:
proxool:delegate-class:delegate-url
or,
proxool.name:delegate-class:delegate-url
where
delegate-class
is the actual Driver that will be used and
delegate-url
is the url that will be based to that Driver
By defining
name
you are able to define multiple connection pools
even if the delegate url is the same.
Provides information about an individual connection.
You can listen to the lifecycle of a connection.
A full definition of everything to do with a connection.
JMX DynamicMBean adapter for a Proxool connection pool.
See the configuration documentation to learn
how to activate a pool for JMX.
This provides real time information about the pool.
Call this every time a connection is refused
This needs to be called _everytime_ a connection is removed.
Responsible for resetting a Connection to its default state when it is
returned to the pool.
Call this every time an active connection is returned to the pool
Return true
if this list contains the specified element.
Return true
if this list contains all of the elements
in the specified Collection.
Get the default capacity used in
default (no-argument) constructor for BoundedChannels
that otherwise require a capacity argument.
Access the reference, waiting if necessary until it is ready.
Return the element at the specified position in the list.
Return active status of t.
The number of connections currently in use.
The number of active (busy) connections
Return the number of threads that are not idly waiting for work.
The age in millseconds since this connection was built
The name associated with this connection pool.
The alias of the pool we are prototyping for
Get the alias of the connection pool this connection belongs to
Get the alias for the connection pool that served a connection
Extracts the pool alias from the url:
proxool.alias:driver:url -> alias
proxool.alias -> alias
Get a list of all the registered pools
Return the array of threads in this group.
The number of connections that are available for use (doesn't include
active connections).
The number of available (free) connections
The average number of active connections,
The average time that each connection spent active.
The time that this connection was created.
Returns the cause of this exception or null
if the
cause is nonexistent or unknown.
The URL that was used to define this pool.
Returns the method in the concrete class with an indentical signature to that passed
Returns the method in the concrete class with an indentical signature to that passed
as a parameter
The real, delegate connection that we are using
The total number of connections, including those being built right
now
The details of one connection.
The details of each connection.
Get details on each connection within the pool.
The ConnectionPool that this connection belongs to
Get the definition of a pool.
Get real-time statistical information about how a pool is performing.
Get real-time statistical information about how a pool is performing.
The number of connections refused.
The number of connections provided.
When this pool was started
When the pool was started
Get the definition that was used to create this connection
Returns the driver provided connection that Proxool wraps up before it gives it to you.
The hashcode (in hex) of the delegate connection object.
Get all of the properties that are defined on the delegated driver.
Returns the driver provided statement that Proxool wraps up before it gives it to you.
The URL that this connection is using (the definition
might have changed since this connection was built).
Get the exception, or null if there isn't one (yet).
Returns true if this list is operating in fast mode.
Get the list of fatal SQL exception (Strings) fragments that will
trigger the death of a Connection.
If this is not-null then any fatal SQLException is wrapped up inside
an instance of this class.
Return the FJTaskRunner thread running the current FJTask.
Return the FJTaskRunnerGroup of the thread running the current FJTask.
Return the FJTaskRunnerGroup of which this thread is a member
Get the next house keeper that needs to be run
This is the time the house keeping thread sleeps for between checks.
The test SQL that we perform to see if a connection is alright.
A unique ID for this connection
A unique ID for this connection
Get the connection ID for a connection
The class name of an interface that should be injected everytime we make a CallableStatement.
The class name of an interface that should be injected everytime we make a Connection.
The class name of an interface that should be injected everytime we make a PreparedStatement.
The class name of an interface that should be injected everytime we make a Statement.
Get a comma separated list of JMX agent ids (as used by
MBeanServerFactory.findMBeanServer(String agentId)
) to register the pool to.
Get the most recent of all the getSqlCalls()
Get the most recent of all the getSqlCalls()
Get a reference to the array of registered listeners.
Return the lock used for all synchronization for this object
Sometimes we want do something to a connection but can't because it is still
active and we don't want to disrupt its use.
Sometimes we want do something to a connection but can't because it is still
active and we don't want to disrupt its use.
If the housekeeper comes across a thread that has been active for longer
than this then it will kill it.
The maximum number of connections to the database
Get the maximum possible connections (as defined in the
definition
.
The maximum amount of time that a connection exists for before it is killed (recycled).
In order to prevent overloading, this is the maximum number of connections that you can have that are in the progress
of being made.
The minimum number of connections we will keep open, regardless of whether anyone needs them or not.
Get the prefered JMX object name for a Proxool pool.
The number of connections that are neither active or available.
The number of offline connections.
Get the SQLException that was detected as being fatal
This is the time in milliseconds after the last time that we refused a
connection that we still consider ourselves to be overloaded.
The password to use to login to the database
The length of time this sample represents,
Get all of the properties that are defined on the delegated driver.
This is the number of spare connections we will strive to have.
Get the encapsulated proxy connection
The hashcode (in hex) of the ProxyConnection object.
Why this connection is marked (for instance, if a thread has
marked it for expiry then it's nice to know why)
As long as we have one connection that was started within this threshold
then we consider the pool to be up.
How many connections have been refused since the pool started
The number of connections refused during this sample.
The rate at which we have refused connections
The name of the thread that asked for this connection.
How many connections have been served since the pool started
The number of connections served during this sample.
The rate at which we have served connections
In order to prevent overloading, this is the maximum number of connections that you can have that are in the progress
of being made.
Calls getSnapshot
using false for the detail parameter.
Gives a snapshot of what the pool is doing
The date that this snapshot applies
A log of the last SQL used on this connection.
A log of the last SQL used on this connection.
When this sample started.
The sample length (in seconds) when taking statistical information,
or null to disable statistics.
Returns the most recent sample that has completed its period
Get all the lastest performance statistics for this pool
Get a particular set of performance statistics for this pool
Whether statistics are logged as they are produced.
The status of the connection.
The status of the connection.
When this connection was last given out.
When this connection was last given back (or zero if it is still active).
This is the URL used to connect to the database.
Generate a valid JMX identifier attribute name from a Proxool property name.
The group of which this FJTaskRunner is a member *
Search for the first occurrence of the given argument, testing
for equality using the equals()
method, and return
the corresponding index, or -1 if the object is not found.
Initializes the cause of this exception to the specified value.
FJTasks are held in an array-based DEQ with INITIAL_CAPACITY
elements.
The initial value of the default capacity is 1024 *
This gets called every time we make a Connection.
Create all FJTaskRunner threads in this group.
Main mechanics for put/offer *
Try to shut down all FJTaskRunner threads in this group
by interrupting them all.
Wrap wait/notify mechanics around a task so that
invoke() can wait it out
Delegates all operations to the encapsulated
ProxyConnection
except for:
- close()
- equals()
- hashCode()
- isClosed()
- getMetaData()
- finalize()
It also spots mutators and remembers that the property has been changed so that it can
be
reset
.
Immediately execute task t by calling its run method.
Start a task and wait it out.
Invokes a method using a cached method.
Whether this connection is available.
Whether we have requested detailed information about each
connection
Return true if current task has terminated or been cancelled.
Test if this list has no elements.
Get wether this container is empty or not.
Indicate wether this pool should be registered with JMX or not.
Whether this connection is due for expiry
Return whether the reference or exception have been set.
Find out if the delegated connection is close.
Whether the ShutdownHook
should do anything.
Whether we test each connection after it is closed
(that is, returned to the pool)
Whether we test each connection before it is served
if this is true then we will log each execution.
If this is true then we start logging a lot of stuff everytime we serve a
connection and everytime the house keeper and prototyper run.
Return an iterator over the elements in this list in proper sequence.
Place item in channel only if it can be accepted within
msecs milliseconds.
Place item in channel only if it can be accepted within
msecs milliseconds.
Place item in channel only if it can be accepted within
msecs milliseconds.
Happens everytime we create a new connection.
Happens just before we expire a connection.
One century in milliseconds; convenient as a time-out value *
ONE_DAY - static field in class org.logicalcobwebs.concurrent.
Sync One day, in milliseconds; convenient as a time-out value *
ONE_HOUR - static field in class org.logicalcobwebs.concurrent.
Sync One hour, in milliseconds; convenient as a time-out value *
One minute, in milliseconds; convenient as a time-out value *
One second, in milliseconds; convenient as a time-out value *
ONE_WEEK - static field in class org.logicalcobwebs.concurrent.
Sync One week, in milliseconds; convenient as a time-out value *
ONE_YEAR - static field in class org.logicalcobwebs.concurrent.
Sync One year in milliseconds; convenient as a time-out value *
Happens after every successful execute.
Happens everytime an exception was thrown during an execute method
Note that the command
is not fully implemented at this stage.
Notify that a new connection pool has been registered.
If the given alias equals this pools alias: Unregister this JMX bean.
Notify that a connection pool will be shutdown.
This gets called /just/ before a connection is served.
A Java SQL Driver that provides a connection pool wrapper around another Driver of your choice.
Provides statistical information on each pool.
Contains an MBean adapter to manage pools through JMX plus a utility to register/deregister these beans.
Contains a helper that can create a Proxool datasource and bind it to JNDI.
The AdminServlet provides information about running pools.
Helpers for configuring Proxool from various sources.
OUtput full HTML including <HTML>, <HEAD> and <BODY> tags.
OUtput simple HTML excluding <HTML>, <HEAD> and <BODY> tags.
Override the method provided by the getConcreteMethod(java.lang.Class, java.lang.reflect.Method)
.
Don't use the one we calculate using getConcreteMethod(java.lang.reflect.Method)
, use this one instead.
A new Par
, when executed,
runs the tasks provided in the constructor in parallel using
coInvoke(tasks).
Construct and return a FJTask object that, when executed, will
invoke task1 and task2, in parallel
Two-task constructor, for compatibility with previous release.
Construct and return a FJTask object that, when executed, will
invoke the tasks in the tasks array in parallel using coInvoke
Construct a Seq that, when executed, will process each of the
tasks in the tasks array in parallel
A new Par(task1, task2)
, when executed,
runs task1 and task2 in parallel using coInvoke(task1, task2).
Return, but do not remove object at head of Channel,
or null if it is empty.
Access the reference, even if not ready
Return and remove an item from channel only if one is available within
msecs milliseconds.
Return and remove an item from channel only if one is available within
msecs milliseconds.
Return and remove an item from channel only if one is available within
msecs milliseconds.
Return a task from entry queue, or null if empty.
Return a popped task, or null if DEQ is empty.
Prints this ProxoolException and its backtrace to the
standard error stream.
Prints this ProxoolException and its backtrace to the specified print stream.
Prints this ProxoolException and its backtrace to the specified
print writer.
Uses a standard Java properties file to configure Proxool.
Responsible for prototyping connections for all pools
Responsible for running
sweep
.
The namespace uri associated with namepace aware Proxool xml configurations.
Value: The latest version is available at http://proxool.sourceforge.net/xml-namespace
All constants here please.
The Proxool DataSource implementation.
This is the Proxool implementation of the java.sql.Driver interface.
Proxool exception class that emulates the behaviour of the new cause
facility in jdk 1.4.
Constructs a new instance with null
as its detail message.
Constructs a new instance with the specified detail message.
Constructs a new instance with the specified detail message and cause.
Constructs a new throwable with the specified cause and a detail
message of (cause==null ? null : cause.toString()) (which
typically contains the class and detail message of cause).
This provides some nice-to-have features that can't be provided by the
java.sql.Driver
implementation
of java.sql.Driver.
Utilities for Proxool JMX instrumentation.
Utilities for Proxool JNDI operations.
Listener for global Proxool events.
Contains most of the functionality that we require to manipilate the
connection.
Place item in the channel, possibly waiting indefinitely until
it can be accepted.
Place item in the channel, possibly waiting indefinitely until
it can be accepted.
Place item in the channel, possibly waiting indefinitely until
it can be accepted.
Enqueue task at base of DEQ.
Helper monitor for managing access to last node.
This interface exists to enable stricter type checking
for channels.
A ReadWriteLock that prefers waiting readers over
waiting writers when there is contention.
ReadWriteLocks maintain a pair of associated locks.
Status -- true after first set *
Close the connection for real
Really close the connection, as opposed to just putting it back
in the pool.
Redefine the behaviour of the pool.
Schedule a regular triggerSweep
Notify that a statement has been closed and won't need closing
when the connection is returned to the poo.
With no configurator or properties (using default values)
Build a ConnectionPool based on this definition and then start it.
Build a ConnectionPool based on this definition and then start it.
Create a
ProxoolDataSource
with the given alias
and bind it to JNDI using the given jndi properties.
Potentially enable others to pass.
Remove the element at the specified position in the list, and shift
any subsequent elements down one position.
Remove the first occurrence of the specified element from the list,
and shift any subsequent elements down one position.
Remove from this collection all of its elements that are contained
in the specified collection.
Removes all connection pools.
Remove a listener that gets called everytime the configuration changes.
Remove a listener that monitors each time a connection is made or destroyed.
Like removeConnectionPool(java.lang.String, int)
but uses no delay.
Remove a connection pool.
Remove a listener from this container.
Remove a registered ProxoolListenerIF
.
Remove a listener that monitors the change of state of the pool (quiet, busy, overloaded, or down)
Clear the termination status of this task.
Reset this connection to its default values.
Constants for Proxool resource names.
Remove from this collection all of its elements except those that are
contained in the specified collection.
Avalon ROLE id for this component.
Priority to use while running tasks *
Total number of tasks run *
Do all but the pop() part of yield or join, by
traversing all DEQs in our group looking for a task to
steal.
Priority to use while scanning for work *
Total number of queues scanned for work *
Same as scan, but called when current thread is idling.
A new Seq
, when executed,
invokes each task provided in the constructor, in order.
Construct and return a FJTask object that, when executed, will
invoke task1 and task2, in order
Two-task constructor, for compatibility with previous release.
Construct and return a FJTask object that, when executed, will
invoke the tasks in the tasks array in array order
Construct a Seq that, when executed, will process each of the
tasks in the tasks array in order
A new Seq2(task1, task2)
, when executed,
invokes task1 and then task2, in order.
Allows you to configure Proxool using a servlet.
Set the default capacity used in
default (no-argument) constructor for BoundedChannels
that otherwise require a capacity argument.
Replace the element at the specified position in this list with
the specified element.
Set the reference, and signal that it is ready.
Set active status of thread t to true, and notify others
that might be waiting for work.
Set any property that should be handed to the delegate driver.
Set the exception field, also setting ready status.
Sets whether this list will operate in fast mode.
Set active status of thread t to false.
The subclass should call this to indicate that a change has been made to
the connection that might mean it needs to be reset (like setting autoCommit
to false or something).
Set the priority to use while a FJTaskRunner is
actively running tasks.
Set the priority to use while running tasks.
Set the priority to use while a FJTaskRunner is
polling for new tasks to perform.
Set the priority to use while scanning.
By remembering the most recent ShutdownHook
ProxoolFacade
will know to disable it when it is shutdown
.
Forces the new status regardless of the old state
Changes the status and lets the ConnectionPool know so that it
can keep count of how many connections are at each status.
Return a Runnable object that, when run, will set the result value.
Stop all house keeper threads.
Stop all house keeper threads
Removes all connection pools.
Removes all connection pools.
Removes all connection pools.
Reader and Writer requests are maintained in two different
wait sets, by two different objects.
Start or wake up any threads waiting for work
Return the number of elements in this list.
Return the number of FJTaskRunner threads in this group *
Backup to handle noninlinable cases of coInvoke
Backup to handle atypical or noninlinable cases of coInvoke
Handle slow case for push
Provides a snapshot of a pool
Monitors the state of the pool so you can see whether it is
quiet, busy, overloaded, or down.
A new set of statistics have just been produced
A new set of statistics have just been produced
Provides statistical performance information for a period ot
time.
Listens to statistics and logs them
Prints various snapshot statistics to System.out.
The connection is available for use
This is the start and end state of every connection
The connection is in use by the house keeping thread
Total number of tasks obtained via scan *
Return a view of the portion of this list between fromIndex
(inclusive) and toIndex (exclusive).
Subtract amount from value (i.e., set value -= amount)
Atomically swap values with another SynchronizedInt.
Trigger prototyping immediately
Sync - interface org.logicalcobwebs.concurrent.
Sync Main interface for locks, gates, and conditions.
A class useful for offloading synch for int instance variables.
Make a new SynchronizedInt with the given initial value,
and using its own internal lock.
Make a new SynchronizedInt with the given initial value,
and using the supplied lock.
Base class for simple, small classes
maintaining single values that are always accessed
and updated under synchronization.
Create a SynchronizedVariable using itself as the lock *
Create a SynchronizedVariable using the supplied lock *
This interface exists to enable stricter type checking
for channels.
Return and remove an item from channel,
possibly waiting indefinitely until
such an item exists.
Take a task from the base of the DEQ.
Return the reference and clear it *
Return and remove an item from channel,
possibly waiting indefinitely until
such an item exists.
Return and remove an item from channel,
possibly waiting indefinitely until
such an item exists.
Process tasks until w is done.
Execute a task in this thread.
The threads in this group *
Wait at most msecs to access the reference.
Thrown by synchronization classes that report
timeouts via exceptions.
Constructs a TimeoutException with given duration value.
Constructs a TimeoutException with the
specified duration value and detail message.
Return an array containing all of the elements in this list in the
correct order.
Return an array containing all of the elements in this list in the
correct order.
Return a String representation of this object.
Trigger prototyping immediately.
Trim the capacity of this ArrayList
instance to be the
list's current size.