Fasterj

|home |articles |cartoons |site map |contact us |
Tools: | GC log analysers| Multi-tenancy tools| Books| SizeOf| Thread analysers|

Our valued sponsors who help make this site possible
Discover the fastest Java Multi-Model DBMS with an Apache 2 License 

Using SharedHashMap - Appendix: interfaces supported

JProfiler
Get rid of your performance problems and memory leaks!


Java Performance Tuning, 2nd ed
The classic and most comprehensive book on tuning Java

Java Performance Tuning Newsletter
Your source of Java performance news. Subscribe now!
Enter email:


OrientDB
Discover the fastest Java Multi-Model DBMS with an Apache 2 License


JProfiler
Get rid of your performance problems and memory leaks!



1 - Using SharedHashMap | 2 - "no-copy" mode | 3 - Concurrency handling and thread safety | 4 - Appendix: interfaces supported | View All

In this article Jack Shirazi and Peter Lawrey give a worked example of using SharedHashMap, a high performance persisted off-heap hash map, shareable across processes.
Published March 2014, Authors Jack Shirazi and Peter Lawrey

Appendix: interfaces supported

The generic method interfaces supported include

	//Bean field accesser
	//TYPE getFIELDNAME();
	int getValue(); //example

	//Bean field updater
	//void setFIELDNAME(TYPE value);
	void setValue(int value); //example

	//Bean field adder
	//TYPE addFIELDNAME(TYPE delta);
	int addValue(int delta); //example

	//Bean field atomic adder
	//TYPE addAtomicFIELDNAME(TYPE delta);
	int addAtomicValue(int delta); //example

	//Bean array-field accesser
	//TYPE getFIELDNAMEAt(int index);
	double getElementAt(int index); //example

	//Bean array-field updater
	//void setFIELDNAMEAt(@MaxSize(MAXSIZE) int index, TYPE value);
	void setElementAt(@MaxSize(4) int index, double value); //example

	//Bean field CAS updater
	//boolean compareAndSwapFIELDNAME(TYPE expected, TYPE value);
	boolean compareAndSwapValue(int expected, int value); //example

	//Try to acquire lock immediately
	//boolean tryLockLOCKNAME();
	boolean tryLockMyLock(); //example

	//Try to acquire lock within nanos nanoseconds
	//boolean tryLockNanosLOCKNAME(long nanos);
	boolean tryLockNanosMyLock(long nanos); //example

	//Keep trying in a busy loop to acquire the lock
	//void busyLockLOCKNAME() throws InterruptedException, IllegalStateException;
	void busyLockMyLock() throws InterruptedException, IllegalStateException; //example

	//Unlock a locked lock, throwing exception if it's not locked
	void unlockLOCKNAME() throws IllegalMonitorStateException;
	void unlockMyLock() throws IllegalMonitorStateException; //example


1 - Using SharedHashMap | 2 - "no-copy" mode | 3 - Concurrency handling and thread safety | 4 - Appendix: interfaces supported | View All


Last Updated: 2017-08-30
Copyright © 2007-2017 Fasterj.com. All Rights Reserved.
All trademarks and registered trademarks appearing on Fasterj.com are the property of their respective owners.
URL: http://www.fasterj.com/articles/sharedhashmap1d.shtml
RSS Feed: http://www.JavaPerformanceTuning.com/newsletters.rss
Trouble with this page? Please contact us