dev@glassfish.java.net

Re: Available features and required work arounds?

From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
Date: Mon, 29 Jun 2009 11:26:13 -0700

Moving discussion to the dev alias.

Can I get my questions answered?

In addition to the q-s below, how without the monitoringEnabled check can I
enable v2 behavior when *if monitoring is on* the transaction manager is locked
for begin/commit/rollback to guarantee the consistent data.

thanks,
-marina

Marina Vatkina wrote:
> Prashanth Abbagani wrote:
>
>> Marina Vatkina wrote:
>>
>>> And one more thing: if I can pass in only primitives into probes, I
>>> do need to know if the monitoring is on - how otherwise I'll skip
>>> these lines:
>>>
>>> if (monitoringEnabled) {
>>> activeTransactions.addElement(tx);
>>> m_transInFlight++;
>>> ComponentInvocation inv = invMgr.getCurrentInvocation();
>>> if (inv != null && inv.getInstance() != null) {
>>>
>>> tx.setComponentName(inv.getInstance().getClass().getName());
>>> }
>>> }
>>
>>
>> You should never check for monitoringEnabled flag when firing the
>> probes. Thats the feature of new monitoring. Probes will always be
>> fired. If there are any listeners registered (based on the monitoring
>> enabled flag which is tuned automatically by the monitoring
>> infrastructure), the listeners get invoked, otherwise it will be a
>> no-op method that gets called.
>
>
> Can I pass transaction and invMgr to the listener? Can I inject the
> invMgr into the listener?
>
> Other questions:
> a) How do I get a hold of the probeProvider?
> b) What is the replacement for String type attribute?
> c) What is the point in time when the listener can cleanup the refs
> (List of activeTransactions in my case).
>
> thanks,
> -marina
>
>>
>>>
>>> thanks,
>>> -marina
>>>
>>> Marina Vatkina wrote:
>>>
>>>> Prashanth Abbagani wrote:
>>>>
>>>>> Ccing Mahesh.
>>>>>
>>>>> My comments inline.
>>>>>
>>>>> Marina Vatkina wrote:
>>>>>
>>>>>> Can somebody list
>>>>>> a) what is already working (i.e *testable*) in the new monitoring
>>>>>> system?
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> When you register your stats provider, you should be able to see
>>>>> them either with asadmin or JConsole as MBeans. This is working today.
>>>>
>>>>
>>>>
>>>>
>>>> How do I do it with asadmin?
>>>>
>>>>>
>>>>> Currently we have a bug in Infrastructure due to which the
>>>>> listeners are not getting invoked, so the stats are not getting
>>>>> updated (they are shown though). This will be fixed soon, but
>>>>> development wise you should be fine. To test the end-end
>>>>> integration, you will have to wait until Tuesday.
>>>>>
>>>>>> b) currently required work arounds?
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> None.
>>>>>
>>>>>>
>>>>>> Also,
>>>>>> c) are there any limitations on the parameter types to the
>>>>>> @Probe/_at_ProbeListener methods?
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Keep the parameters to primitive types. We will think of enhancing
>>>>> this in the next release.
>>>>>
>>>>>> d) are there any restrictions on what can be done inside those
>>>>>> methods?
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> AFAIK, no restrictions. Mahesh, correct me if I am wrong.
>>>>>
>>>>>>
>>>>>> Here is the monitoring code from v2 <TM>.commit:
>>>>>> try{
>>>>>> if(monitoringEnabled){
>>>>>> freezeLock.acquireReadLock();
>>>>>> acquiredlock = true;
>>>>>> }
>>>>>> tx.commit(); // commit local tx
>>>>>> if (monitoringEnabled){
>>>>>> monitorTxCompleted(obj, true);
>>>>>> }
>>>>>> }catch(RollbackException e){
>>>>>> if (monitoringEnabled){
>>>>>> monitorTxCompleted(obj, false);
>>>>>> }
>>>>>> throw e;
>>>>>> }catch(HeuristicRollbackException e){
>>>>>> if (monitoringEnabled){
>>>>>> monitorTxCompleted(obj, false);
>>>>>> }
>>>>>> throw e;
>>>>>> }catch(HeuristicMixedException e){
>>>>>> if (monitoringEnabled){
>>>>>> monitorTxCompleted(obj, true);
>>>>>> }
>>>>>> throw e;
>>>>>> }finally{
>>>>>> if(acquiredlock){
>>>>>> freezeLock.releaseReadLock();
>>>>>> }
>>>>>> }
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> You will not need to check for the monitoringEnabled flag. You will
>>>>> just fire them always, by calling the probeProvider.<myprobe> method.
>>>>
>>>>
>>>>
>>>>
>>>> How do I get a hold of the probeProvider?
>>>>
>>>> thanks,
>>>> -marina
>>>>
>>>>>
>>>>>>
>>>>>>
>>>>>> thanks,
>>>>>> -marina
>>>>>>
>>>>>
>>>>
>>>
>>
>