Class TParserPoolFactory

Object
gudusoft.gsqlparser.TParserPoolFactory

public class TParserPoolFactory extends Object
Factory class for managing parser pool instances. Provides singleton access to parser pools and configuration options.
  • Method Details

    • getSharedPool

      public static TParserPool getSharedPool()
      Gets the shared global parser pool instance. Creates it lazily with double-checked locking.
      Returns:
      Shared parser pool instance
    • getNamedPool

      public static TParserPool getNamedPool(String name, int poolSize)
      Creates or gets a named parser pool. Useful for isolating pools for different components or use cases.
      Parameters:
      name - Pool name
      poolSize - Size of the pool
      Returns:
      Named parser pool instance
    • getNamedPool

      public static TParserPool getNamedPool(String name)
      Gets a named parser pool with default size.
      Parameters:
      name - Pool name
      Returns:
      Named parser pool instance
    • setDefaultPoolSize

      public static void setDefaultPoolSize(int size)
      Sets the default pool size for new pools.
      Parameters:
      size - Default pool size
    • resetSharedPool

      public static void resetSharedPool()
      Resets the shared pool instance. The old pool is shut down and a new one will be created on next access.
    • removeNamedPool

      public static void removeNamedPool(String name)
      Removes and shuts down a named pool.
      Parameters:
      name - Pool name
    • shutdownAll

      public static void shutdownAll()
      Shuts down all pools.
    • parseSQL

      public static int parseSQL(EDbVendor vendor, String sqlText)
      Convenience method to parse SQL using the shared pool. This is a drop-in replacement for direct TGSqlParser usage.
      Parameters:
      vendor - Database vendor
      sqlText - SQL text to parse
      Returns:
      Parse result (0 for success, non-zero for errors)
    • tokenizeSQL

      public static int tokenizeSQL(EDbVendor vendor, String sqlText)
      Convenience method to tokenize SQL using the shared pool.
      Parameters:
      vendor - Database vendor
      sqlText - SQL text to tokenize
      Returns:
      0 for success, -1 for error
    • getAllStatistics

      public static String getAllStatistics()
      Gets statistics for all pools.
      Returns:
      String representation of all pool statistics