Package org.apache.torque.map

Examples of org.apache.torque.map.MapBuilder


    {
        synchronized (mapBuilders)
        {
            try
            {
                MapBuilder mb = (MapBuilder) mapBuilders.get(name);

                if (mb == null)
                {
                    mb = (MapBuilder) Class.forName(name).newInstance();
                    // Cache the MapBuilder before it is built.
                    mapBuilders.put(name, mb);
                }

                // Build the MapBuilder in its own synchronized block to
                //  avoid locking up the whole Hashtable while doing so.
                // Note that *all* threads need to do a sync check on isBuilt()
                //  to avoid grabing an uninitialized MapBuilder. This, however,
                //  is a relatively fast operation.

                if (mb.isBuilt())
                {
                    return mb;
                }

                try
                {
                    mb.doBuild();
                }
                catch (Exception e)
                {
                    // need to think about whether we'd want to remove
                    //  the MapBuilder from the cache if it can't be
View Full Code Here


     */
    public static MapBuilder getMapBuilder(String name)
    {
        try
        {
            MapBuilder mb = (MapBuilder) mapBuilders.get(name);
            // Use the 'double-check pattern' for syncing
            //  caching of the MapBuilder.
            if (mb == null)
            {
                synchronized (mapBuilders)
                {
                    mb = (MapBuilder) mapBuilders.get(name);
                    if (mb == null)
                    {
                        mb = (MapBuilder) Class.forName(name).newInstance();
                        // Cache the MapBuilder before it is built.
                        mapBuilders.put(name, mb);
                    }
                }
            }

            // Build the MapBuilder in its own synchronized block to
            //  avoid locking up the whole Hashtable while doing so.
            // Note that *all* threads need to do a sync check on isBuilt()
            //  to avoid grabing an uninitialized MapBuilder. This, however,
            //  is a relatively fast operation.
            synchronized (mb)
            {
                if (!mb.isBuilt())
                {
                    try
                    {
                        mb.doBuild();
                    }
                    catch (Exception e)
                    {
                        // need to think about whether we'd want to remove
                        //  the MapBuilder from the cache if it can't be
View Full Code Here

                if (null == entry.getValue())
                {
                    try
                    {
                        // create and build the MapBuilder
                        MapBuilder builder = (MapBuilder) Class.forName((String) entry.getKey()).newInstance();
       
                        if (!builder.isBuilt())
                        {
                            builder.doBuild();
                        }
   
                        entry.setValue(builder);
                    }
                    catch (Exception e)
View Full Code Here

    public MapBuilder getMapBuilder(String className)
        throws TorqueException
    {
        try
        {
            MapBuilder mb = (MapBuilder)mapBuilderCache.get(className);

            if (mb == null)
            {
                mb = (MapBuilder) Class.forName(className).newInstance();
                // Cache the MapBuilder before it is built.
                mapBuilderCache.put(className, mb);
            }

            if (mb.isBuilt())
            {
                return mb;
            }

            try
            {
                mb.doBuild();
            }
            catch (Exception e)
            {
                // remove the MapBuilder from the cache if it can't be built correctly
                mapBuilderCache.remove(className);
View Full Code Here

    {
        synchronized (mapBuilders)
        {
            try
            {
                MapBuilder mb = (MapBuilder) mapBuilders.get(name);

                if (mb == null)
                {
                    mb = (MapBuilder) Class.forName(name).newInstance();
                    // Cache the MapBuilder before it is built.
                    mapBuilders.put(name, mb);
                }

                // Build the MapBuilder in its own synchronized block to
                //  avoid locking up the whole Hashtable while doing so.
                // Note that *all* threads need to do a sync check on isBuilt()
                //  to avoid grabing an uninitialized MapBuilder. This, however,
                //  is a relatively fast operation.

                if (mb.isBuilt())
                {
                    return mb;
                }

                try
                {
                    mb.doBuild();
                }
                catch (Exception e)
                {
                    // need to think about whether we'd want to remove
                    //  the MapBuilder from the cache if it can't be
View Full Code Here

     */
    public static MapBuilder getMapBuilder(String name)
    {
        try
        {
            MapBuilder mb = (MapBuilder) mapBuilders.get(name);
            // Use the 'double-check pattern' for syncing
            //  caching of the MapBuilder.
            if (mb == null)
            {
                synchronized (mapBuilders)
                {
                    mb = (MapBuilder) mapBuilders.get(name);
                    if (mb == null)
                    {
                        mb = (MapBuilder) Class.forName(name).newInstance();
                        // Cache the MapBuilder before it is built.
                        mapBuilders.put(name, mb);
                    }
                }
            }

            // Build the MapBuilder in its own synchronized block to
            //  avoid locking up the whole Hashtable while doing so.
            // Note that *all* threads need to do a sync check on isBuilt()
            //  to avoid grabing an uninitialized MapBuilder. This, however,
            //  is a relatively fast operation.
            synchronized (mb)
            {
                if (!mb.isBuilt())
                {
                    try
                    {
                        mb.doBuild();
                    }
                    catch (Exception e)
                    {
                        // need to think about whether we'd want to remove
                        //  the MapBuilder from the cache if it can't be
View Full Code Here

                if (null == entry.getValue())
                {
                    try
                    {
                        // create and build the MapBuilder
                        MapBuilder builder = (MapBuilder) Class.forName((String) entry.getKey()).newInstance();
       
                        if (!builder.isBuilt())
                        {
                            builder.doBuild();
                        }
   
                        entry.setValue(builder);
                    }
                    catch (Exception e)
View Full Code Here

    public MapBuilder getMapBuilder(String className)
        throws TorqueException
    {
        try
        {
            MapBuilder mb = (MapBuilder)mapBuilderCache.get(className);

            if (mb == null)
            {
                mb = (MapBuilder) Class.forName(className).newInstance();
                // Cache the MapBuilder before it is built.
                mapBuilderCache.put(className, mb);
            }

            if (mb.isBuilt())
            {
                return mb;
            }

            try
            {
                mb.doBuild();
            }
            catch (Exception e)
            {
                // remove the MapBuilder from the cache if it can't be built correctly
                mapBuilderCache.remove(className);
View Full Code Here

    {
        synchronized (mapBuilders)
        {
            try
            {
                MapBuilder mb = (MapBuilder) mapBuilders.get(name);

                if (mb == null)
                {
                    mb = (MapBuilder) Class.forName(name).newInstance();
                    // Cache the MapBuilder before it is built.
                    mapBuilders.put(name, mb);
                }

                // Build the MapBuilder in its own synchronized block to
                //  avoid locking up the whole Hashtable while doing so.
                // Note that *all* threads need to do a sync check on isBuilt()
                //  to avoid grabing an uninitialized MapBuilder. This, however,
                //  is a relatively fast operation.

                if (mb.isBuilt())
                {
                    return mb;
                }

                try
                {
                    mb.doBuild();
                }
                catch (Exception e)
                {
                    // need to think about whether we'd want to remove
                    //  the MapBuilder from the cache if it can't be
View Full Code Here

TOP

Related Classes of org.apache.torque.map.MapBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.