org.springframework.util.ConcurrentReferenceHashMap.Reference Java Examples

The following examples show how to use org.springframework.util.ConcurrentReferenceHashMap.Reference. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConcurrentReferenceHashMapTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Override
protected ReferenceManager createReferenceManager() {
	return new ReferenceManager() {
		@Override
		public Reference<K, V> createReference(Entry<K, V> entry, int hash, @Nullable Reference<K, V> next) {
			if (TestWeakConcurrentCache.this.disableTestHooks) {
				return super.createReference(entry, hash, next);
			}
			return new MockReference<>(entry, hash, next, TestWeakConcurrentCache.this.queue);
		}
		@Override
		public Reference<K, V> pollForPurge() {
			if (TestWeakConcurrentCache.this.disableTestHooks) {
				return super.pollForPurge();
			}
			return TestWeakConcurrentCache.this.queue.isEmpty() ? null : TestWeakConcurrentCache.this.queue.removeFirst();
		}
	};
}
 
Example #2
Source File: ConcurrentReferenceHashMapTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Override
protected ReferenceManager createReferenceManager() {
	return new ReferenceManager() {
		@Override
		public Reference<K, V> createReference(Entry<K, V> entry, int hash, @Nullable Reference<K, V> next) {
			if (TestWeakConcurrentCache.this.disableTestHooks) {
				return super.createReference(entry, hash, next);
			}
			return new MockReference<>(entry, hash, next, TestWeakConcurrentCache.this.queue);
		}
		@Override
		public Reference<K, V> pollForPurge() {
			if (TestWeakConcurrentCache.this.disableTestHooks) {
				return super.pollForPurge();
			}
			return TestWeakConcurrentCache.this.queue.isEmpty() ? null : TestWeakConcurrentCache.this.queue.removeFirst();
		}
	};
}
 
Example #3
Source File: ConcurrentReferenceHashMapTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Override
protected ReferenceManager createReferenceManager() {
	return new ReferenceManager() {
		@Override
		public Reference<K, V> createReference(Entry<K, V> entry, int hash,
				Reference<K, V> next) {
			if (TestWeakConcurrentCache.this.disableTestHooks) {
				return super.createReference(entry, hash, next);
			}
			return new MockReference<K, V>(entry, hash, next, TestWeakConcurrentCache.this.queue);
		}
		@Override
		public Reference<K, V> pollForPurge() {
			if (TestWeakConcurrentCache.this.disableTestHooks) {
				return super.pollForPurge();
			}
			return TestWeakConcurrentCache.this.queue.isEmpty() ? null : TestWeakConcurrentCache.this.queue.removeFirst();
		}
	};
}
 
Example #4
Source File: ConcurrentReferenceHashMapTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
public MockReference(Entry<K, V> entry, int hash, Reference<K, V> next, LinkedList<MockReference<K, V>> queue) {
	this.hash = hash;
	this.entry = entry;
	this.next = next;
	this.queue = queue;
}
 
Example #5
Source File: ConcurrentReferenceHashMapTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
public Reference<K, V> getNext() {
	return this.next;
}
 
Example #6
Source File: ConcurrentReferenceHashMapTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
public MockReference(Entry<K, V> entry, int hash, Reference<K, V> next, LinkedList<MockReference<K, V>> queue) {
	this.hash = hash;
	this.entry = entry;
	this.next = next;
	this.queue = queue;
}
 
Example #7
Source File: ConcurrentReferenceHashMapTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
public Reference<K, V> getNext() {
	return this.next;
}
 
Example #8
Source File: ConcurrentReferenceHashMapTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
public MockReference(Entry<K, V> entry, int hash, Reference<K, V> next, LinkedList<MockReference<K, V>> queue) {
	this.hash = hash;
	this.entry = entry;
	this.next = next;
	this.queue = queue;
}
 
Example #9
Source File: ConcurrentReferenceHashMapTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public Reference<K, V> getNext() {
	return this.next;
}