Changeset 5302


Ignore:
Timestamp:
Aug 30, 2016, 4:20:10 AM (6 years ago)
Author:
Christian Schulte
Message:

o Updated to protect against concurrent accesses.

See #107

Location:
jomc-tools/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • jomc-tools/trunk/jomc-ant-tasks/src/main/java/org/jomc/tools/ant/ProjectClassLoader.java

    r5274 r5302  
    100100     * Excluded modlets.
    101101     */
    102     private Modlets excludedModlets;
     102    private final Modlets excludedModlets = new Modlets();
    103103
    104104    /**
     
    110110     * Excluded services.
    111111     */
    112     private Services excludedServices;
     112    private final Services excludedServices = new Services();
    113113
    114114    /**
     
    120120     * Excluded schemas.
    121121     */
    122     private Schemas excludedSchemas;
     122    private final Schemas excludedSchemas = new Schemas();
    123123
    124124    /**
     
    130130     * Set of excluded providers.
    131131     */
    132     private Set<String> excludedProviders;
     132    private final Set<String> excludedProviders = Collections.synchronizedSet( new HashSet<String>( 128 ) );
    133133
    134134    /**
     
    150150     * Set of temporary resources.
    151151     */
    152     private final Set<File> temporaryResources = new HashSet<>( 128 );
     152    private final Set<File> temporaryResources = Collections.synchronizedSet( new HashSet<File>( 128 ) );
    153153
    154154    /**
     
    395395    public final Modlets getExcludedModlets()
    396396    {
    397         if ( this.excludedModlets == null )
    398         {
    399             this.excludedModlets = new Modlets();
    400         }
    401 
    402397        return this.excludedModlets;
    403398    }
     
    447442    public final Set<String> getExcludedProviders()
    448443    {
    449         if ( this.excludedProviders == null )
    450         {
    451             this.excludedProviders = new HashSet<>( 128 );
    452         }
    453 
    454444        return this.excludedProviders;
    455445    }
     
    499489    public final Services getExcludedServices()
    500490    {
    501         if ( this.excludedServices == null )
    502         {
    503             this.excludedServices = new Services();
    504         }
    505 
    506491        return this.excludedServices;
    507492    }
     
    551536    public final Schemas getExcludedSchemas()
    552537    {
    553         if ( this.excludedSchemas == null )
    554         {
    555             this.excludedSchemas = new Schemas();
    556         }
    557 
    558538        return this.excludedSchemas;
    559539    }
     
    775755    }
    776756
    777     private void addExcludedModlet( final Modlet modlet )
     757    private synchronized void addExcludedModlet( final Modlet modlet )
    778758    {
    779759        try
     
    801781    }
    802782
    803     private void addExcludedSchema( final Schema schema )
     783    private synchronized void addExcludedSchema( final Schema schema )
    804784    {
    805785        if ( this.getExcludedSchemas().getSchemaBySystemId( schema.getSystemId() ) == null )
     
    809789    }
    810790
    811     private void addExcludedService( final Service service )
     791    private synchronized void addExcludedService( final Service service )
    812792    {
    813793        for ( int i = 0, s0 = this.getExcludedServices().getService().size(); i < s0; i++ )
  • jomc-tools/trunk/jomc-cli/src/main/java/org/jomc/tools/cli/commands/AbstractModletCommand.java

    r5298 r5302  
    475475         * {@code Modlets} excluded by the instance.
    476476         */
    477         private Modlets excludedModlets;
     477        private final Modlets excludedModlets = new Modlets();
    478478
    479479        /**
     
    604604        public Modlets getExcludedModlets()
    605605        {
    606             if ( this.excludedModlets == null )
    607             {
    608                 this.excludedModlets = new Modlets();
    609             }
    610 
    611606            return this.excludedModlets;
    612607        }
     
    855850                        it.remove();
    856851                        filtered = true;
    857                         this.getExcludedModlets().getModlet().add( m );
     852                        synchronized ( this )
     853                        {
     854                            this.getExcludedModlets().getModlet().add( m );
     855                        }
    858856                        log( Level.FINE,
    859857                             Messages.getMessage( "modletExclusionInfo", resource.toExternalForm(), m.getName() ),
Note: See TracChangeset for help on using the changeset viewer.