Code example for ReadWriteLock

Methods: readLock, writeLock

0
public class CommonDataPublisher implements DataPublishable { 
 
	// Per each definition there is a lock, to make each definition creation 
	// atomic 
	private static final ReadWriteLock readWriteLock = new ReentrantReadWriteLock();
	private static final Lock readLock = readWriteLock.readLock();
	private static final Lock writeLock = readWriteLock.writeLock();
 
	// defaults 
	private String streamName = StreamsDefinitions.RSS_STATS_TABLE;
	private String streamVersion = StreamsDefinitions.VERSION;
	private String streamDefinition = StreamsDefinitions.RSS_STATS_TABLE_STREAM_DEF;
	private String configFileName = RSSPublisherConstants.CONFIGURATION_FILE_NAME;
 
	public CommonDataPublisher() { 
	} 
 
	public CommonDataPublisher(String streamName, String streamVersion, String streamDefinition,
	                           String configFileName) {
		super(); 
		if (StringUtils.isNotEmpty(streamName)) {