=== modified file 'src/com/goldencode/p2j/jmx/NanoTimer.java'
--- old/src/com/goldencode/p2j/jmx/NanoTimer.java	2022-10-31 09:52:21 +0000
+++ new/src/com/goldencode/p2j/jmx/NanoTimer.java	2023-02-15 15:52:30 +0000
@@ -120,13 +120,13 @@
     * @param r
     *        operation to be executed
     */
-   public void timer(Operation r)
+   public void timer(Operation r, Object... args)
    {
        if (!enabled)
        {
            try
            {
-              r.exec();
+              r.exec(args);
            } 
            catch (RuntimeException re)
            {
@@ -142,7 +142,50 @@
        start();
        try
        {
-          r.exec();
+          r.exec(args);
+       }
+       catch (RuntimeException re)
+       {
+          // unchecked exception propagate as is.  otherwise, we can't process ConditionException.
+          throw re;
+       }
+       catch (Exception e)
+       {
+          throw new RuntimeException(e);
+       }
+       finally
+       {
+           stop();
+       }
+   }
+
+   /**
+    * Execute operation and measure execution time
+    * @param r
+    *        operation to be executed
+    */
+   public Object timer(ReturningOperation r, Object... args)
+   {
+       if (!enabled)
+       {
+           try
+           {
+              return r.exec(args);
+           } 
+           catch (RuntimeException re)
+           {
+              // unchecked exception propagate as is.  otherwise, we can't process ConditionException.
+              throw re;
+           }
+           catch (Exception e)
+           {
+              throw new RuntimeException(e);
+           }
+       }
+       start();
+       try
+       {
+          return r.exec(args);
        }
        catch (RuntimeException re)
        {

=== modified file 'src/com/goldencode/p2j/jmx/Operation.java'
--- old/src/com/goldencode/p2j/jmx/Operation.java	2020-10-02 14:48:30 +0000
+++ new/src/com/goldencode/p2j/jmx/Operation.java	2023-02-15 15:52:10 +0000
@@ -73,6 +73,6 @@
     * Execute operation
     * @throws Exception
     */
-   public void exec() 
+   public void exec(Object... args) 
    throws Exception;
 }

=== added file 'src/com/goldencode/p2j/jmx/ReturningOperation.java'
--- old/src/com/goldencode/p2j/jmx/ReturningOperation.java	1970-01-01 00:00:00 +0000
+++ new/src/com/goldencode/p2j/jmx/ReturningOperation.java	2023-02-15 15:55:51 +0000
@@ -0,0 +1,13 @@
+package com.goldencode.p2j.jmx;
+
+/** Functional interface for operations which may throw exceptions */
+@FunctionalInterface
+public interface ReturningOperation
+{
+   /**
+    * Execute operation
+    * @throws Exception
+    */
+   public Object exec(Object... args) 
+   throws Exception;
+}
\ No newline at end of file

=== modified file 'src/com/goldencode/p2j/net/Message.java'
--- old/src/com/goldencode/p2j/net/Message.java	2020-09-30 15:20:25 +0000
+++ new/src/com/goldencode/p2j/net/Message.java	2023-02-15 16:28:18 +0000
@@ -426,9 +426,7 @@
       key.readExternal(in);
 
 //      System.err.printf("Deserializing payload for %d; ", requestID);
-      NANO_TIMER.timer(
-            () -> setPayload(PayloadSerializer.readPayload(in))
-      );
+      NANO_TIMER.timer((Operation) (args) -> setPayload(PayloadSerializer.readPayload((ObjectInput) args[0])), in);
 //      onRead();
    }
 
@@ -452,9 +450,8 @@
       out.writeInt(requestID);
       key.writeExternal(out);
 //      onWrite();
-      NANO_TIMER.timer(
-            () -> PayloadSerializer.writePayload(out, payload)
-      );
+      NANO_TIMER.timer((Operation) (args) -> 
+         PayloadSerializer.writePayload((ObjectOutput) args[0], args[1]), out, payload);
    }
       
    /*

=== modified file 'src/com/goldencode/p2j/net/Protocol.java'
--- old/src/com/goldencode/p2j/net/Protocol.java	2022-10-17 07:02:39 +0000
+++ new/src/com/goldencode/p2j/net/Protocol.java	2023-02-15 16:11:30 +0000
@@ -648,9 +648,7 @@
                // Java approach handles reading an entire array as a single
                // entity which is something we want to avoid doing ourselves
                
-               TO_BYTE_ARRAY_TIMER.timer(
-                    () -> setData(objToByteArray(obj))
-               );
+               TO_BYTE_ARRAY_TIMER.timer((Operation) (args) -> setData(objToByteArray((Message) args[0])), obj);
                if (data != null)
                {
                   OUTGOING.update(data.length);

=== modified file 'src/com/goldencode/p2j/persist/BufferImpl.java'
--- old/src/com/goldencode/p2j/persist/BufferImpl.java	2023-02-15 09:42:13 +0000
+++ new/src/com/goldencode/p2j/persist/BufferImpl.java	2023-02-15 16:11:28 +0000
@@ -9836,11 +9836,7 @@
    @Override
    protected boolean resourceDelete()
    {
-      boolean[] res = new boolean[1];
-      
-      RESOURCE_DEL.timer(() -> res[0] = resourceDeleteImpl());
-      
-      return res[0];
+      return (boolean) RESOURCE_DEL.timer((ReturningOperation) (args) -> resourceDeleteImpl());
    }
    
    /**

=== modified file 'src/com/goldencode/p2j/persist/DataSet.java'
--- old/src/com/goldencode/p2j/persist/DataSet.java	2023-02-08 15:18:05 +0000
+++ new/src/com/goldencode/p2j/persist/DataSet.java	2023-02-15 16:13:20 +0000
@@ -526,7 +526,11 @@
     */
    public static void associate(DataSetParameter dsSrc, DataSet dsTarget, EnumSet<ParameterOption> options)
    {
-      STATIC_PARAM.timer(() -> associateImpl(dsSrc, dsTarget, options));
+      STATIC_PARAM.timer((Operation) (args) -> associateImpl(
+               (DataSetParameter) args[0], 
+               (DataSet) args[1], 
+               (EnumSet<ParameterOption>) args[2]), 
+            dsSrc, dsTarget, options);
    }
    
    /**
@@ -832,7 +836,11 @@
                                            handle           dsHandle,
                                            ParameterOption  option)
    {
-      DYN_PARAM.timer(() -> createDynamicDataSetImpl(dsParam, dsHandle, option));
+      DYN_PARAM.timer((Operation) (args) -> createDynamicDataSetImpl(
+               (DataSetParameter) args[0], 
+               (handle) args[1], 
+               (ParameterOption) args[2]), 
+            dsParam, dsHandle, option);
    }
    
    /**

=== modified file 'src/com/goldencode/p2j/persist/DynamicQueryHelper.java'
--- old/src/com/goldencode/p2j/persist/DynamicQueryHelper.java	2023-01-16 20:50:19 +0000
+++ new/src/com/goldencode/p2j/persist/DynamicQueryHelper.java	2023-02-15 16:09:39 +0000
@@ -142,8 +142,6 @@
 
 import java.io.*;
 import java.util.*;
-import java.util.List;
-import java.util.Map;
 import java.util.concurrent.atomic.*;
 import java.util.logging.*;
 import antlr.*;
@@ -297,6 +295,7 @@
     *
     * @return  A {@link P2JQuery} instance representing the given legacy query string.
     */
+   @SuppressWarnings("unchecked")
    private static P2JQuery parse(QueryProcessor processor,
                                  List<Buffer> buffers,
                                  String predicate0,
@@ -363,11 +362,12 @@
             final SymbolResolver[] sym = new SymbolResolver[1]; // build the symbol resolver
             final SchemaDictionary[] dict = new SchemaDictionary[1];
             
-            PROCESS_SYMRES.timer(() -> {
+            // TODO: refactor to stop using stateful lambda
+            PROCESS_SYMRES.timer((args) -> {
                sym[0] = SymbolResolver.newRuntimeInstance();
-               dict[0] = RecordBuffer.getSchemaDictionary(allBuffers);
-               sym[0].setSchemaDictionary(dict[0]); // set the schema dictionary used by this context
-            });
+               dict[0] = RecordBuffer.getSchemaDictionary((List<Buffer>) args[0]);
+               sym[0].setSchemaDictionary((SchemaDictionary) args[1]); // set the schema dictionary used by this context
+            }, allBuffers, dict[0]);
             
             try
             {
@@ -376,7 +376,11 @@
                try
                {
                   // load the p2o and schema data
-                  PROCESS_SCHEMADICT.timer(() -> prepareTempTable(dict[0], pCode, wa.p2oFile, wa.buffers));
+                  PROCESS_SCHEMADICT.timer((Operation) (args) -> prepareTempTable((SchemaDictionary) args[0], 
+                                                                                  (StringBuilder) args[1], 
+                                                                                  (String) args[2], 
+                                                                                  (ArrayList<Buffer>) args[3]),
+                                           dict[0], pCode, wa.p2oFile, wa.buffers);
                }
                catch (RuntimeException exc2)
                {
@@ -394,7 +398,7 @@
                }
                
                // add a default scope that represents the scope of the external procedure
-               PROCESS_SYMRES.timer(() -> sym[0].addSchemaScope(false));
+               PROCESS_SYMRES.timer((Operation) (args) -> ((SymbolResolver) args[0]).addSchemaScope(false), sym[0]);
                
                // parse the predicate
                String predicate = processor.preparePredicate(predicate0);
@@ -410,7 +414,7 @@
                Exception err = null;
                String oeCode = pCode.toString();
                StringReader in = new StringReader(oeCode);
-               PROCESS_PARSE.timer(() -> {
+               PROCESS_PARSE.timer((args) -> {
                   lexer[0] = new ProgressLexer(in, sym[0]);
                   lexer[0].setUnixEscapes(!EnvironmentOps.isUnderWindowsFamily());
                   parser[0] = new ProgressParser(lexer[0], sym[0]);
@@ -430,7 +434,7 @@
                   //         OPEN QUERY DynGenQuery <query-predicate>.
                   
 //                  PROCESS_PARSE2.timer(() -> parser[0].external_proc());
-                  PROCESS_PARSE2.timer(() -> parser[0].dynamic_query_proc());
+                  PROCESS_PARSE2.timer((Operation) (args) -> ((ProgressParser) args[0]).dynamic_query_proc(), parser[0]);
                   complete = true;
                }
                catch (RuntimeException exc2)
@@ -466,7 +470,7 @@
                {
                   // prepare the initial AST
                   ProgressAst finalPAst0 = (ProgressAst) parser[0].getAST();
-                  PROCESS_SETUP.timer(() -> {
+                  PROCESS_SETUP.timer((args) -> {
                      finalPAst0.brainwash(wa.dynQueryFile, true);
                      prepareTree(finalPAst0, wa.buffers, wa.dynQueryFile, DYN_GEN_QUERY_CLASS);
                      
@@ -491,13 +495,16 @@
                   if (qAst == null)
                   {
                      // run conversion
-                     PROCESS_ANNOTATION.timer(() -> ConversionPool.runTask(ConversionProfile.ANNOTATIONS, finalPAst0));
+                     PROCESS_ANNOTATION.timer((Operation) (args) -> 
+                        ConversionPool.runTask(ConversionProfile.ANNOTATIONS, (Aast) args[0]), finalPAst0);
                      
                      ProgressAst finalPAst1 = (ProgressAst) astManager.loadTree(wa.astFile);
-                     PROCESS_BASE.timer(() -> ConversionPool.runTask(ConversionProfile.BASE_STRUCTURE, finalPAst1));
+                     PROCESS_BASE.timer((Operation) (args) -> 
+                        ConversionPool.runTask(ConversionProfile.BASE_STRUCTURE, (Aast) args[0]), finalPAst1);
                      
                      ProgressAst finalPAst2 = (ProgressAst) astManager.loadTree(wa.astFile);
-                     PROCESS_CORE.timer(() -> ConversionPool.runTask(ConversionProfile.CORE_CONVERSION, finalPAst2));
+                     PROCESS_CORE.timer((Operation) (args) -> 
+                        ConversionPool.runTask(ConversionProfile.CORE_CONVERSION, (Aast) args[0]), finalPAst2);
                      
                      ProgressAst pAst = (ProgressAst) astManager.loadTree(wa.astFile);
                      
@@ -513,7 +520,8 @@
                      JavaAst jCode = (JavaAst) astManager.loadTree(wa.jastFile);
                      // DBG: System.out.println(jCode.dumpTree(true));
                      // DBG: System.out.println(ConversionPool.runTask(ConversionProfile.BREW, jCode).getStoredObject(DYN_GEN_QUERY_CLASS));
-                     PROCESS_POST.timer(() -> processor.postprocessJavaAst(jCode));
+                     PROCESS_POST.timer((Operation) (args) -> 
+                        ((QueryProcessor) args[0]).postprocessJavaAst((JavaAst) args[1]), processor, jCode);
                      
                      qAst = (JavaAst) astManager.loadTree(wa.jastFile);
                      if (qAst == null)
@@ -971,10 +979,13 @@
          }
       };
       
-      P2JQuery[] res = new P2JQuery[1];
-      PARSE_QUERY.timer(() -> res[0] = parse(openQueryProcessor, buffers, predicate, qname, substBuffers));
-      
-      return res[0];
+      return (P2JQuery) PARSE_QUERY.timer((ReturningOperation) (args) -> 
+         parse((QueryProcessor) args[0], 
+                (List<Buffer>) args[1], 
+                (String) args[2], 
+                (String) args[3], 
+                (List<Buffer>) args[4]), 
+         openQueryProcessor, buffers, predicate, qname, substBuffers);
    }
    
    /**
@@ -1106,11 +1117,14 @@
             }
          };
          
-         P2JQuery[] res = new P2JQuery[1];
-         String pred = predicate;
-         PARSE_FIND.timer(() -> res[0] = parse(findQueryProcessor, buffers, pred, qname, substBuffers));
-         
-         return res[0];
+
+         return (P2JQuery) PARSE_FIND.timer((ReturningOperation) (args) -> 
+            parse((QueryProcessor) args[0], 
+                  (List<Buffer>) args[1], 
+                  (String) args[2], 
+                  (String) args[3], 
+                  (List<Buffer>) args[4]), 
+            findQueryProcessor, buffers, predicate, qname, substBuffers);
       }
       finally
       {

=== modified file 'src/com/goldencode/p2j/persist/FQLHelper.java'
--- old/src/com/goldencode/p2j/persist/FQLHelper.java	2022-11-03 00:24:27 +0000
+++ new/src/com/goldencode/p2j/persist/FQLHelper.java	2023-02-15 16:14:07 +0000
@@ -462,7 +462,8 @@
          String fwhere = StringHelper.safeTrim(where);
          FQLHelper[] res = new FQLHelper[1];
          
-         FQL_HELPER.timer(() -> 
+         // This lamba is really big and does a lot of linking work. Try to reduce!
+         FQL_HELPER.timer((timerArgs) -> 
          {
             try
             {

=== modified file 'src/com/goldencode/p2j/persist/OutputDataSetCopier.java'
--- old/src/com/goldencode/p2j/persist/OutputDataSetCopier.java	2022-10-06 08:18:44 +0000
+++ new/src/com/goldencode/p2j/persist/OutputDataSetCopier.java	2023-02-15 16:14:46 +0000
@@ -108,7 +108,7 @@
    @Override
    public void finished()
    {
-      COPIER.timer(() -> srcDS.performOutputCopy(outputParam));
+      COPIER.timer((Operation) (args) -> ((DataSet) args[0]).performOutputCopy((DataSetParameter) args[1]), srcDS, outputParam);
    }
 
    /** No-op. */

=== modified file 'src/com/goldencode/p2j/persist/OutputDataSetHandleCopier.java'
--- old/src/com/goldencode/p2j/persist/OutputDataSetHandleCopier.java	2023-02-04 19:05:49 +0000
+++ new/src/com/goldencode/p2j/persist/OutputDataSetHandleCopier.java	2023-02-15 16:15:06 +0000
@@ -133,7 +133,7 @@
    @Override
    public void finished()
    {
-      COPIER.timer(() -> finishedImpl());
+      COPIER.timer((Operation) (args) -> finishedImpl());
    }
    
    /** Copies data in OUTPUT direction in DataSet-handle parameter case. */

=== modified file 'src/com/goldencode/p2j/persist/OutputTableCopier.java'
--- old/src/com/goldencode/p2j/persist/OutputTableCopier.java	2022-10-06 08:18:44 +0000
+++ new/src/com/goldencode/p2j/persist/OutputTableCopier.java	2023-02-15 16:15:45 +0000
@@ -104,7 +104,8 @@
    @Override
    public void finished()
    {
-      COPIER.timer(() -> srcBuf.performOutputCopy(outputParam));
+      COPIER.timer((Operation) (args) -> 
+         ((TemporaryBuffer) args[0]).performOutputCopy((TableParameter) args[1]), srcBuf, outputParam);
    }
 
    /** No-op. */

=== modified file 'src/com/goldencode/p2j/persist/OutputTableHandleCopier.java'
--- old/src/com/goldencode/p2j/persist/OutputTableHandleCopier.java	2023-01-16 20:50:19 +0000
+++ new/src/com/goldencode/p2j/persist/OutputTableHandleCopier.java	2023-02-15 16:15:57 +0000
@@ -127,7 +127,7 @@
    @Override
    public void finished()
    {
-      COPIER.timer(() -> finishedImpl());
+      COPIER.timer((Operation) (args) -> finishedImpl());
    }
    
    /** Copies data in OUTPUT direction in table-handle parameter case.*/

=== modified file 'src/com/goldencode/p2j/persist/PreselectQuery.java'
--- old/src/com/goldencode/p2j/persist/PreselectQuery.java	2023-01-20 12:07:41 +0000
+++ new/src/com/goldencode/p2j/persist/PreselectQuery.java	2023-02-15 16:16:56 +0000
@@ -6588,19 +6588,20 @@
 
       translateWhere();
       
-      Operation oper = () ->
+      Operation oper = (args) ->
       {
          // need to put together order by clause first, as the sort criteria determined in this analysis may be
          // needed when composing the from-clause and where clause
          List<SortCriterion> sortCriteria = assembleOrderByClause();
+         StringBuilder sb = (StringBuilder) args[0];
          
-         assembleSelectClause(buf);
-         assembleFromClause(buf, sortCriteria);
-         buf.append(assembleWhereClause(sortCriteria).toFinalExpression());
-         generateOrderBy(sortCriteria, buf);
+         assembleSelectClause(sb);
+         assembleFromClause(sb, sortCriteria);
+         sb.append(assembleWhereClause(sortCriteria).toFinalExpression());
+         generateOrderBy(sortCriteria, sb);
       };
 
-      QUERY_ASSEMBLE.timer(oper);
+      QUERY_ASSEMBLE.timer(oper, buf);
       
       return buf.toString().trim();
    }

=== modified file 'src/com/goldencode/p2j/persist/RecordBuffer.java'
--- old/src/com/goldencode/p2j/persist/RecordBuffer.java	2023-01-23 18:18:57 +0000
+++ new/src/com/goldencode/p2j/persist/RecordBuffer.java	2023-02-15 16:34:36 +0000
@@ -2020,7 +2020,8 @@
    {
       Buffer[] res = new Buffer[1];
       
-      DEF_BUFFER.timer(() ->
+      // TODO there are too many fields linked to this lambda; reduce
+      DEF_BUFFER.timer((args) ->
       {
          RecordBuffer buffer = new RecordBuffer(def, dmoBufIface, database, null);
          buffer.initialize();
@@ -2165,7 +2166,8 @@
    {
       Buffer[] res = new Buffer[1];
       
-      DEF_BUFFER.timer(() ->
+      // TODO: too many lambda references
+      DEF_BUFFER.timer((Operation) (args) ->
       {
          RecordBuffer buffer = new RecordBuffer(def, dmoBufIface, database, variable, blockDepth);
          

=== modified file 'src/com/goldencode/p2j/persist/RuntimeJastInterpreter.java'
--- old/src/com/goldencode/p2j/persist/RuntimeJastInterpreter.java	2022-10-31 09:45:09 +0000
+++ new/src/com/goldencode/p2j/persist/RuntimeJastInterpreter.java	2023-02-15 16:20:05 +0000
@@ -422,9 +422,8 @@
       Aast aMethod = classMethods.get(methodName);
       if (aMethod != null)
       {
-         Object[] res = new Object[1];
-         QUERY_INTERPRET.timer(() -> res[0] = execMethod(aMethod, args));
-         return res[0];
+         // this lambda is linked to the args parameter
+         return QUERY_INTERPRET.timer((ReturningOperation) (opArgs) -> execMethod(aMethod, args));
       }
       throw new InterpreterException("No such method defined", null, null);
    }

=== modified file 'src/com/goldencode/p2j/persist/TableMapper.java'
--- old/src/com/goldencode/p2j/persist/TableMapper.java	2023-01-18 13:51:25 +0000
+++ new/src/com/goldencode/p2j/persist/TableMapper.java	2023-02-15 16:20:38 +0000
@@ -1650,15 +1650,15 @@
     */
    static void mapTemporaryTable(TempTable table)
    {
-      MAP.timer(() -> 
+      MAP.timer((Operation) (args) -> 
       {
-         TempTableMapper mapper = locateTemp(table);
+         TempTableMapper mapper = locateTemp((TempTable) args[0]);
          
          synchronized (mapper)
          {
-            mapper.mapClass(table);
+            mapper.mapClass((TempTable) args[0]);
          }
-      });
+      }, table);
    }
    
    /**

=== modified file 'src/com/goldencode/p2j/persist/TempTableBuilder.java'
--- old/src/com/goldencode/p2j/persist/TempTableBuilder.java	2023-02-15 09:42:13 +0000
+++ new/src/com/goldencode/p2j/persist/TempTableBuilder.java	2023-02-15 16:26:28 +0000
@@ -2491,16 +2491,17 @@
          }
       }
       
-      boolean[] res = new boolean[1];
-      CREATE_DYN_TT.timer(() -> res[0] = DynamicTablesHelper.getInstance().createDynamicDMO(this, tableName));
-      if (res[0])
+      boolean res = (boolean) CREATE_DYN_TT.timer((ReturningOperation) (args) -> 
+            DynamicTablesHelper.getInstance().createDynamicDMO((TempTableBuilder) args[0], (String) args[1]),
+         this, tableName);
+      if (res)
       {
          super.name(new character(tableName)); // also makes table "prepared"
          createDefaultBuffer();
          
          if (beforeName != null)
          {
-            res[0] = createBeforeTable(beforeName);
+            res = createBeforeTable(beforeName);
          }
          
          if (beforeTableType == BeforeType.UNKNOWN)
@@ -2513,7 +2514,7 @@
          forceClear();
       }
       
-      return new logical(res[0]);
+      return new logical(res);
    }
    
    /**

=== modified file 'src/com/goldencode/p2j/persist/TemporaryBuffer.java'
--- old/src/com/goldencode/p2j/persist/TemporaryBuffer.java	2023-02-15 09:42:13 +0000
+++ new/src/com/goldencode/p2j/persist/TemporaryBuffer.java	2023-02-15 16:25:17 +0000
@@ -1059,7 +1059,8 @@
    {
       TempTableBuffer[] res = new TempTableBuffer[1];
       
-      DEF_BUFFER.timer(() ->
+      // too many lambda references, reduce
+      DEF_BUFFER.timer((args) ->
       {
          TemporaryBuffer buffer = makeBuffer(def, dmoBufIface, variable, global, new DefaultUndoState(true));
          
@@ -1407,7 +1408,8 @@
    {
       TempTableBuffer[] res = new TempTableBuffer[1];
       
-      DEF_BUFFER.timer(() ->
+      // too many lambda links, reduce
+      DEF_BUFFER.timer((args) ->
       {
          TemporaryBuffer buffer = makeBuffer(def, dmoBufIface, variable, global, undoable, blockDepth);
          
@@ -1768,12 +1770,10 @@
    {
       TempTableBuffer[] res = new TempTableBuffer[1];
       
-      DEF_BUFFER.timer(() ->
-      {
-         res[0] = defineImpl(def, template, variable, legacyName, blockDepth, shared, mutable);
-      });
-      
-      return (T) res[0];
+      // TODO remap define parameters through the lambda args
+      return (T) DEF_BUFFER.timer((ReturningOperation) (args) ->
+         defineImpl(def, template, variable, legacyName, blockDepth, shared, mutable)
+      );
    }
    
    /**
@@ -2137,7 +2137,11 @@
     */
    public static void associate(final TableParameter src, Temporary dstDMO, ParameterOption option)
    {
-      STATIC_PARAM.timer(() -> associateImpl(src, dstDMO, EnumSet.of(option)));
+      STATIC_PARAM.timer((Operation) (args) -> associateImpl(
+               (TableParameter) args[0], 
+               (Temporary) args[1], 
+               (EnumSet<ParameterOption>) args[2]), 
+            src, dstDMO, EnumSet.of(option));
    }
    
    /**
@@ -2162,7 +2166,11 @@
     */
    public static void associate(TableParameter src, Temporary dstDMO, EnumSet<ParameterOption> options)
    {
-      STATIC_PARAM.timer(() -> associateImpl(src, dstDMO, options));
+      STATIC_PARAM.timer((Operation) (args) -> associateImpl(
+               (TableParameter) args[0], 
+               (Temporary) args[1], 
+               (EnumSet<ParameterOption>) args[2]), 
+            src, dstDMO, options);
    }
    
    /**
@@ -2696,7 +2704,11 @@
     */
    public static void createDynamicTable(TableParameter src, handle target, ParameterOption option)
    {
-      DYN_PARAM.timer(() -> createDynamicTableImpl(src, target, option));
+      DYN_PARAM.timer((Operation) (args) -> createDynamicTableImpl(
+               (TableParameter) args[0], 
+               (handle) args[1], 
+               (ParameterOption) args[2]), 
+            src, target, option);
    }
    
    /**
@@ -3601,7 +3613,8 @@
                                                             TempTable tempTable)
    {
       Temporary[] temporary = new Temporary[1];
-      CREATE_BUFFER.timer(() ->
+      // TODO: too many lambda links; reduce
+      CREATE_BUFFER.timer((args) ->
       {
          final BufferManager bufferManager = master != null ? master.bufferManager : BufferManager.get();
          String uniqueBufferName = bufferManager.generateUniqueBufferName(bufferName);

=== modified file 'src/com/goldencode/p2j/persist/orm/Query.java'
--- old/src/com/goldencode/p2j/persist/orm/Query.java	2023-02-10 09:39:25 +0000
+++ new/src/com/goldencode/p2j/persist/orm/Query.java	2023-02-15 16:27:57 +0000
@@ -345,7 +345,8 @@
    {
       if (sqlQuery == null)
       {
-         Operation op = () ->
+         // TODO: lots of references inside this lambda: reduce
+         Operation op = (args) ->
          {
             FqlToSqlConverter fql2sql = FqlToSqlConverter.getInstance(dialect, db, params);
             rowStructure = new ArrayList<>(2); // this should be enough for most cases

=== modified file 'src/com/goldencode/p2j/persist/orm/SQLQuery.java'
--- old/src/com/goldencode/p2j/persist/orm/SQLQuery.java	2023-02-10 09:39:25 +0000
+++ new/src/com/goldencode/p2j/persist/orm/SQLQuery.java	2023-02-15 16:31:40 +0000
@@ -327,8 +327,7 @@
          
          log(() -> "FWD ORM: " + stmt);
          ResultSet[] resultSetArray = new ResultSet[1];
-         SQLStatementLogger.getLogger().
-            log(session.getDatabase(), stmt, () -> resultSetArray[0] = stmt.executeQuery());
+         SQLStatementLogger.getLogger().log(session.getDatabase(), stmt, (args) -> resultSetArray[0] = stmt.executeQuery());
          
          ResultSet resultSet = resultSetArray[0];
          reportSQLWarnings(session);
@@ -377,8 +376,7 @@
          
          log(() -> "FWD ORM: " + stmt);
          ResultSet[] resultSetArray = new ResultSet[1];
-         SQLStatementLogger.getLogger().
-            log(session.getDatabase(), stmt, () -> resultSetArray[0] = stmt.executeQuery());
+         SQLStatementLogger.getLogger().log(session.getDatabase(), stmt, (args) -> resultSetArray[0] = stmt.executeQuery());
          
          ResultSet resultSet = resultSetArray[0];
          return new ScrollableResults<>(stmt, resultSet, rowStructure, session);
@@ -444,8 +442,7 @@
          
          log(() -> "FWD ORM: " + stmt);
          ResultSet[] resultSetArray = new ResultSet[1];
-         SQLStatementLogger.getLogger().
-            log(session.getDatabase(), stmt, () -> resultSetArray[0] = stmt.executeQuery());
+         SQLStatementLogger.getLogger().log(session.getDatabase(), stmt, (args) -> resultSetArray[0] = stmt.executeQuery());
          
          ResultSet resultSet = resultSetArray[0];
          reportSQLWarnings(session);
@@ -516,8 +513,7 @@
          
          log(() -> "FWD ORM: " + stmt);
          int[] result = new int[1];
-         SQLStatementLogger.getLogger().
-            log(session.getDatabase(), stmt, () -> result[0] = stmt.executeUpdate());
+         SQLStatementLogger.getLogger().log(session.getDatabase(), stmt, (args) -> result[0] = stmt.executeUpdate());
          
          return result[0];
       }
@@ -570,7 +566,7 @@
          log(() -> "FWD ORM: " + stmt);
          ResultSet[] resultSetArray = new ResultSet[1];
          SQLStatementLogger.getLogger().
-            log(session.getDatabase(), stmt, () -> resultSetArray[0] = stmt.executeQuery());
+            log(session.getDatabase(), stmt, (args) -> resultSetArray[0] = stmt.executeQuery());
          
          ResultSet resultSet = resultSetArray[0];
 
@@ -708,9 +704,13 @@
                                    Session session)
    throws PersistenceException
    {
-      BaseRecord[] res = new BaseRecord[1];
-      HYDRATE_RECORD.timer(() -> res[0] = hydrateRecordImpl(resultSet, rowStructure, rsOffset, session));
-      return res[0];
+      return (BaseRecord) HYDRATE_RECORD.timer((ReturningOperation) (args) -> 
+            hydrateRecordImpl(
+                     (ResultSet) args[0], 
+                     (RowStructure) args[1], 
+                     (int) args[2], 
+                     (Session) args[3]),
+         resultSet, rowStructure, rsOffset, session);
    }
    
    /**

=== modified file 'src/com/goldencode/p2j/persist/orm/SavepointManager.java'
--- old/src/com/goldencode/p2j/persist/orm/SavepointManager.java	2023-02-03 19:01:50 +0000
+++ new/src/com/goldencode/p2j/persist/orm/SavepointManager.java	2023-02-15 16:28:26 +0000
@@ -89,6 +89,7 @@
 
 import com.goldencode.p2j.jmx.FwdJMX;
 import com.goldencode.p2j.jmx.NanoTimer;
+import com.goldencode.p2j.jmx.Operation;
 import com.goldencode.p2j.persist.*;
 import com.goldencode.p2j.util.*;
 import com.goldencode.p2j.util.LogHelper;
@@ -472,7 +473,8 @@
    {
       if (session != null && activeBlock != null)
       {
-         NO_UNDO_TRACE.timer(() -> {
+         // going to be removed anyways
+         NO_UNDO_TRACE.timer((args) -> {
             SQLRedo.Insert redo = new SQLRedo.Insert(session.getPersister(), dmo.deepCopy());
             redoable.add(redo);
          });
@@ -491,7 +493,8 @@
    {
       if (session != null && activeBlock != null && dmo.checkState(CHANGED))
       {
-         NO_UNDO_TRACE.timer(() -> {
+         // going to be removed anyways
+         NO_UNDO_TRACE.timer((args) -> {
             SQLRedo.Update redo = new SQLRedo.Update(session.getPersister(), dmo.deepCopy());
             redoable.add(redo);
          });
@@ -512,7 +515,8 @@
    {
       if (session != null && activeBlock != null)
       {
-         NO_UNDO_TRACE.timer(() -> {
+         // going to be removed anyways
+         NO_UNDO_TRACE.timer((args) -> {
             SQLRedo.Delete redo = new SQLRedo.Delete(session.getPersister(), dmoClass, id);
             redoable.add(redo);
          });
@@ -532,7 +536,8 @@
    {
       if (session != null && activeBlock != null)
       {
-         NO_UNDO_TRACE.timer(() -> {
+         // going to be removed anyways
+         NO_UNDO_TRACE.timer((args) -> {
             SQLRedo.BulkUpdate redo = new SQLRedo.BulkUpdate(session, query);
             redoable.add(redo);
          });
@@ -647,7 +652,8 @@
       // let the noUndoRolledBack flag check here to avoid profiling disabled redo
       if (session != null && lastActiveBlock != null && lastActiveBlock.noUndoRolledBack)
       {
-         REDO.timer(() -> lastActiveBlock.maybeReapplyNoUndo(session));
+         // going to be removed anyways
+         REDO.timer((Operation) (args) -> lastActiveBlock.maybeReapplyNoUndo(session));
       }
       
       // reactivate the next block in the stack (if any)

=== modified file 'src/com/goldencode/p2j/persist/orm/UnclosablePreparedStatement.java'
--- old/src/com/goldencode/p2j/persist/orm/UnclosablePreparedStatement.java	2022-10-31 09:52:21 +0000
+++ new/src/com/goldencode/p2j/persist/orm/UnclosablePreparedStatement.java	2023-02-15 16:32:12 +0000
@@ -468,7 +468,8 @@
    {
       Object[] res = new Object[1];
       SQLException[] exc = new SQLException[1];
-      EXEC.timer(() -> 
+      // TODO use lambda args
+      EXEC.timer((args) -> 
       { 
          try
          {

=== modified file 'src/com/goldencode/p2j/security/ContextLocal.java'
--- old/src/com/goldencode/p2j/security/ContextLocal.java	2022-10-31 09:52:21 +0000
+++ new/src/com/goldencode/p2j/security/ContextLocal.java	2023-02-15 15:56:00 +0000
@@ -454,12 +454,8 @@
     * @return  Context local variable.
     */
    public final T get(boolean create)
-   {
-      Object[] res = new Object[1];
-      
-      GET.timer(() -> res[0] = getImpl(create));
-      
-      return (T) res[0];
+   {      
+      return (T) GET.timer((ReturningOperation) (args) -> getImpl((boolean) args[0]), create);
    }
    
    /**

=== modified file 'src/com/goldencode/p2j/ui/ServerState.java'
--- old/src/com/goldencode/p2j/ui/ServerState.java	2022-09-15 17:49:53 +0000
+++ new/src/com/goldencode/p2j/ui/ServerState.java	2023-02-15 15:53:42 +0000
@@ -254,11 +254,11 @@
       environments = readList(in, (Supplier<EnvironmentColorTable>) EnvironmentColorTable::new);
       
       deadFrames = readIntArray(in);
-      NANO_TIMER.timer(() ->
+      NANO_TIMER.timer((args) ->
       {
-         setWidgetAttrIds((int[]) PayloadSerializer.readPayload(in));
-         setWidgetAttrValues((Object[]) PayloadSerializer.readPayload(in));
-      });
+         setWidgetAttrIds((int[]) PayloadSerializer.readPayload((ObjectInput) args[0]));
+         setWidgetAttrValues((Object[]) PayloadSerializer.readPayload((ObjectInput) args[0]));
+      }, in);
    }
 
    /**
@@ -288,10 +288,10 @@
       
       writeIntArray(out, deadFrames);
       
-      NANO_TIMER.timer(() ->
+      NANO_TIMER.timer((args) ->
       {
-         PayloadSerializer.writePayload(out, widgetAttrIds);
-         PayloadSerializer.writePayload(out, widgetAttrValues);
-      });
+         PayloadSerializer.writePayload((ObjectOutput) args[0], args[1]);
+         PayloadSerializer.writePayload((ObjectOutput) args[0], args[2]);
+      }, out, widgetAttrIds, widgetAttrValues);
    }
 }

=== modified file 'src/com/goldencode/p2j/util/LegacyJavaAppserver.java'
--- old/src/com/goldencode/p2j/util/LegacyJavaAppserver.java	2023-02-06 18:05:00 +0000
+++ new/src/com/goldencode/p2j/util/LegacyJavaAppserver.java	2023-02-15 16:33:18 +0000
@@ -963,7 +963,8 @@
    @Override
    public void addTableMetaData(DataObject metaData, DataObject table)
    {
-      TABLE_META.timer(() -> DataSetSDOHelper.addTableMetaData(metaData, table));
+      TABLE_META.timer((Operation) (args) -> 
+         DataSetSDOHelper.addTableMetaData((DataObject) args[0], (DataObject) args[1]), metaData, table);
    }
 
    /**
@@ -1041,7 +1042,8 @@
    {
       LegacyJavaAppserverParameter[] res = new LegacyJavaAppserverParameter[1];
       
-      JAVA_PARAM.timer(() ->
+      // TODO: Huge lambda; try to reduce!
+      JAVA_PARAM.timer((args) ->
       {
          Object value = pvalue;
          Object orig = value;
@@ -1188,7 +1190,8 @@
    {
       Object[] res = new Object[1];
       
-      OUTPUT_PARAM.timer(() -> 
+      // TODO: huge lambda; try to reduce
+      OUTPUT_PARAM.timer((args) -> 
       {
          int type = param.getType();
          Object arg = param.getValue();

=== modified file 'src/com/goldencode/p2j/util/TransactionManager.java'
--- old/src/com/goldencode/p2j/util/TransactionManager.java	2023-01-18 13:51:25 +0000
+++ new/src/com/goldencode/p2j/util/TransactionManager.java	2023-02-15 16:33:46 +0000
@@ -6653,7 +6653,8 @@
          return;
       }
       
-      ROLLBACK.timer(() ->
+      // TODO: huge lambda; try to reduce
+      ROLLBACK.timer((args) ->
       {
          if (LOG.isLoggable(Level.FINE))
          {
@@ -6751,8 +6752,9 @@
       {
          return;
       }
-      
-      COMMIT.timer(() ->
+
+      // TODO: huge lambda; try to reduce
+      COMMIT.timer((args) ->
       {
          if (LOG.isLoggable(Level.FINE))
          {
@@ -7070,7 +7072,8 @@
    private static void processValidate(WorkArea wa)
    throws ErrorConditionException
    {
-      VALIDATE.timer(() ->
+      // TODO: huge lambda; try to reduce
+      VALIDATE.timer((args) ->
       {
          if (LOG.isLoggable(Level.FINE))
          {

