class NTv2GridShiftFactory extends ReferencingFactory implements BufferedFactory {

    public GridShiftFile createNTv2Grid(URL gridLocation) throws FactoryException {
        if(gridLocation == null) {
            throw new FactoryException("The grid location must be not null");
        }
        
        synchronized (ntv2GridCache) { // Prevent simultaneous threads trying to load same grid
            GridShiftFile grid = ntv2GridCache.get(gridLocation.toExternalForm());
            if (grid != null) { // Cached:
                return grid; // - Return
            } else { // Not cached:
                if (gridLocation != null) {
                    grid = loadNTv2Grid(gridLocation); // - Load
                    if (grid != null) {
                        ntv2GridCache.put(gridLocation.toExternalForm(), grid); // - Cache
                        return grid; // - Return
                    }
                }
                throw new FactoryException("NTv2 Grid " + gridLocation + " could not be created.");
            }
        }
    }

    public  NTv2GridShiftFactory();
    public  NTv2GridShiftFactory(final int priority);

}