patterntesting.concurrent.ThreadSafeCollectionCheck.aj Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of patterntesting-concurrent Show documentation
Show all versions of patterntesting-concurrent Show documentation
PatternTesting Concurrent (patterntesting-concurrent) is a collection
of useful thread aspects. It has support for testing, for
sychnronization and for concurrent programming.
Some of the ideas used in this library comes from reading
Brian Goetz's book "Java Concurrency in Practice".
/*
* $Id: ThreadSafeCollectionCheck.aj,v 1.1 2011/12/22 17:28:11 oboehm Exp $
*
* Copyright (c) 2008 by Oliver Boehm
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express orimplied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* (c)reated 06.10.2008 by oliver ([email protected])
*/
package patterntesting.concurrent;
import patterntesting.annotation.concurrent.ForceThreadSafeCollection;
/**
* If you mark a class with "@ForceThreadSafeCollection" you should use only the
* thread-safe Java collections, e.g.
*
* - Map: Hashtable, SynchronizedMap or ConcurrentMap
* - Collection: Vector, CopyOnWriteArrayList, CopyOnWriteArraySet or
* SynchronizedList
*
* - Queue: BlockingQueue or ConcurrentLinkedQueue
*
* (see "Java Concurrency in Practice" (Brian Goetz), p. 52)
*
* @author oliver
* @since 06.10.2008
*/
public aspect ThreadSafeCollectionCheck extends AbstractThreadSafeCollectionCheck {
/**
* Application code.
*/
public pointcut applicationCode() :
within(@ForceThreadSafeCollection *)
|| withincode(@ForceThreadSafeCollection *..*.new(..))
|| withincode(@ForceThreadSafeCollection !synchronized * *..*.*(..));
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy