All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.vmlens.trace.agent.bootstrap.callback.HashMapForDirectMemoryAccess Maven / Gradle / Ivy

There is a newer version: 1.1.5
Show newest version
package com.vmlens.trace.agent.bootstrap.callback;

import gnu.trove.map.hash.TLongObjectHashMap;

public class HashMapForDirectMemoryAccess {
	
	
	private final TLongObjectHashMap memoryAddress2Element = new
            TLongObjectHashMap();
	
	
	public static interface ElementFactory
	{
		ELEMENT create();
		
	}
	

	private final ElementFactory factory;
	
	
	
	
	
	
	
	
	public HashMapForDirectMemoryAccess(ElementFactory factory) {
		super();
		this.factory = factory;
	}


	public synchronized ELEMENT getOrCreate(long address)
	{
		
		ELEMENT result = memoryAddress2Element.get(address);
		
		if( result == null )
		{
			result = factory.create();
			memoryAddress2Element.put(address, result);
			
			
			
		}
		
		
		
		return result;
		
	}
	
	
//	clear()
//	{
//		
//	}
//	
//	
//	allocate()
//	{
//		
//	}
//	
//	
//	reallocate()
//	{
//		
//	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy