Class SlowQueryReportJmx.PoolJmx
- Enclosing class:
SlowQueryReportJmx
notifyPool=false mode, the ObjectName the pool's MBean occupies.
The state hangs from the pool's statistics store (see SlowQueryReport.PoolStatistics.getJmxState()), which is 1:1 with
the pool, and nothing a pool published can be given up by another pool's close. It is built by the first
borrower that needs it and given up by the release of the store it hangs from, which is what the close of the
pool is.
The publication is attempted once per pool: JMX is a best-effort management channel, so a refusal is logged and
not retried by later borrows. Publication and release are serialised against each other by this object's monitor,
and the MBeanServer is called outside it: a borrow either publishes, finds that the attempt has already been
made, or finds the state already superseded by the pool's close - in which case the borrow gives back the
publication it just made. A published MBean can therefore never outlive the state that published it, and the
ObjectName a release gives up is the one this state recorded when it published, whatever class or
objectName property the interceptor instance running the close happens to carry.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanDecides whether the calling borrow is to make this pool's one publication attempt.protected NotificationBroadcasterSupportReturns the broadcaster all interceptor instances of this pool send their notifications through, building it on the first need.protected StringReturns the name of the pool this state belongs to.protected booleanReturns whether the close of this pool has given this state up.protected booleanpublished(ObjectName oname) Records a publication the MBeanServer accepted.protected ObjectNameReturns the ObjectName this pool's MBean is published under.protected voidreleased()Gives up everything this state holds: the ObjectName the pool's MBean occupied, which the MBeanServer is asked to release, and with it the broadcaster the pool's clients' listeners are attached to.
-
Constructor Details
-
PoolJmx
Creates the JMX state of one pool.- Parameters:
poolName- the name the pool's registrations are keyed under
-
-
Method Details
-
getPoolName
Returns the name of the pool this state belongs to.- Returns:
- the name recorded at the pool's start
-
publishedUnder
Returns the ObjectName this pool's MBean is published under.- Returns:
- the published ObjectName, or
nullwhile nothing is published for this pool
-
isReleased
protected boolean isReleased()Returns whether the close of this pool has given this state up.- Returns:
trueif the pool has closed
-
broadcaster
Returns the broadcaster all interceptor instances of this pool send their notifications through, building it on the first need.- Returns:
- this pool's broadcaster; never
null
-
beginPublication
protected boolean beginPublication()Decides whether the calling borrow is to make this pool's one publication attempt.- Returns:
trueif the caller is to attempt the publication - none has been made or attempted yet, and the pool has not closed - andfalsewhen there is nothing left to do
-
published
Records a publication the MBeanServer accepted.- Parameters:
oname- the ObjectName the MBean was published under- Returns:
trueif the publication stands and is now this pool's MBean, andfalsewhen the pool's close landed while the MBeanServer was taking it in - nothing else in this JVM will ever learn of that publication, so the borrow that made it has to give it back
-
released
protected void released()Gives up everything this state holds: the ObjectName the pool's MBean occupied, which the MBeanServer is asked to release, and with it the broadcaster the pool's clients' listeners are attached to. The close of the pool's statistics store calls this, and it is idempotent: a later call, from any thread, does nothing.The broadcaster itself is left in place rather than dropped: whoever still holds this pool's registration can subscribe to it, and a subscription made after the pool came down is served by a broadcaster nothing will ever send through, which is what a released registration has to answer a stale handle with. What must not survive the release is the published MBean, and it does not: the ObjectName is given up here, against the name this state recorded when it published.
-