public void setAccessible(AbstractMetadataRecord record, Boolean result) { if (this.globalState.accessible == null) { this.globalState.accessible = new LRUCache<>(1000); } this.globalState.accessible.put(record, result); }
public void setAccessible(AbstractMetadataRecord record, Boolean result) { if (this.globalState.accessible == null) { this.globalState.accessible = new LRUCache<>(1000); } this.globalState.accessible.put(record, result); }
public void setAccessible(AbstractMetadataRecord record, Boolean result) { if (this.globalState.accessible == null) { this.globalState.accessible = new LRUCache<>(1000); } this.globalState.accessible.put(record, result); }
protected boolean removeEldestEntry(Map.Entry<java.util.List<?>,TupleBuffer> eldest) { if (super.removeEldestEntry(eldest)) { if (spillOver != null && eldest.getValue().getRowCount() <= 2) { spillOver.put(eldest.getKey(), eldest.getValue()); } else { eldest.getValue().remove(); } return true; } return false; }
protected boolean removeEldestEntry(Map.Entry<java.util.List<?>,TupleBuffer> eldest) { if (super.removeEldestEntry(eldest)) { if (spillOver != null && eldest.getValue().getRowCount() <= 2) { spillOver.put(eldest.getKey(), eldest.getValue()); } else { eldest.getValue().remove(); } return true; } return false; }
protected boolean removeEldestEntry(Map.Entry<java.util.List<?>,TupleBuffer> eldest) { if (super.removeEldestEntry(eldest)) { if (spillOver != null && eldest.getValue().getRowCount() <= 2) { spillOver.put(eldest.getKey(), eldest.getValue()); } else { eldest.getValue().remove(); } return true; } return false; }
public static Pattern getPattern(String newPattern, String originalPattern, int flags) throws ExpressionEvaluationException { List<?> key = Arrays.asList(newPattern, flags); Pattern p = patternCache.get(key); if (p == null) { try { p = Pattern.compile(newPattern, Pattern.DOTALL); patternCache.put(key, p); } catch(PatternSyntaxException e) { throw new ExpressionEvaluationException(QueryPlugin.Event.TEIID30448, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30448, new Object[]{originalPattern, e.getMessage()})); } } return p; }
public static Pattern getPattern(String newPattern, String originalPattern, int flags) throws ExpressionEvaluationException { List<?> key = Arrays.asList(newPattern, flags); Pattern p = patternCache.get(key); if (p == null) { try { p = Pattern.compile(newPattern, Pattern.DOTALL); patternCache.put(key, p); } catch(PatternSyntaxException e) { throw new ExpressionEvaluationException(QueryPlugin.Event.TEIID30448, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30448, new Object[]{originalPattern, e.getMessage()})); } } return p; }
public static Pattern getPattern(String newPattern, String originalPattern, int flags) throws ExpressionEvaluationException { List<?> key = Arrays.asList(newPattern, flags); Pattern p = patternCache.get(key); if (p == null) { try { p = Pattern.compile(newPattern, Pattern.DOTALL); patternCache.put(key, p); } catch(PatternSyntaxException e) { throw new ExpressionEvaluationException(QueryPlugin.Event.TEIID30448, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30448, new Object[]{originalPattern, e.getMessage()})); } } return p; }
public static SimpleDateFormat getDateFormat(CommandContext context, String format) { SimpleDateFormat result = null; if (context != null) { if (context.globalState.dateFormatCache == null) { context.globalState.dateFormatCache = new LRUCache<String, SimpleDateFormat>(32); } else { result = context.globalState.dateFormatCache.get(format); } } if (result == null) { result = new SimpleDateFormat(format); //TODO: could be locale sensitive if (context != null) { context.globalState.dateFormatCache.put(format, result); } } return result; }
public static SimpleDateFormat getDateFormat(CommandContext context, String format) { SimpleDateFormat result = null; if (context != null) { if (context.globalState.dateFormatCache == null) { context.globalState.dateFormatCache = new LRUCache<String, SimpleDateFormat>(32); } else { result = context.globalState.dateFormatCache.get(format); } } if (result == null) { result = new SimpleDateFormat(format); //TODO: could be locale sensitive if (context != null) { context.globalState.dateFormatCache.put(format, result); } } return result; }
public static SimpleDateFormat getDateFormat(CommandContext context, String format) { SimpleDateFormat result = null; if (context != null) { if (context.globalState.dateFormatCache == null) { context.globalState.dateFormatCache = new LRUCache<String, SimpleDateFormat>(32); } else { result = context.globalState.dateFormatCache.get(format); } } if (result == null) { result = new SimpleDateFormat(format); //TODO: could be locale sensitive if (context != null) { context.globalState.dateFormatCache.put(format, result); } } return result; }
/** * Returns the IndexBlock (containing words) with the given number. */ protected IndexBlock getIndexBlock(int blockNum) throws IOException { Integer key= new Integer(blockNum); Block block= (Block) blockCache.get(key); if (block != null && block instanceof IndexBlock) return (IndexBlock) block; IndexBlock indexBlock= new GammaCompressedIndexBlock(IIndexConstants.BLOCK_SIZE); indexBlock.read(raf, blockNum); blockCache.put(key, indexBlock); return indexBlock; }
/** * Returns the FileListBlock with the given number. */ protected FileListBlock getFileListBlock(int blockNum) throws IOException { Integer key= new Integer(blockNum); Block block= (Block) blockCache.get(key); if (block != null && block instanceof FileListBlock) return (FileListBlock) block; FileListBlock fileListBlock= new FileListBlock(IIndexConstants.BLOCK_SIZE); fileListBlock.read(raf, blockNum); blockCache.put(key, fileListBlock); return fileListBlock; }
/** * Returns the IndexBlock (containing words) with the given number. */ protected IndexBlock getIndexBlock(int blockNum) throws IOException { Integer key= new Integer(blockNum); Block block= (Block) blockCache.get(key); if (block != null && block instanceof IndexBlock) return (IndexBlock) block; IndexBlock indexBlock= new GammaCompressedIndexBlock(IIndexConstants.BLOCK_SIZE); indexBlock.read(raf, blockNum); blockCache.put(key, indexBlock); return indexBlock; }
/** * Returns the FileListBlock with the given number. */ protected FileListBlock getFileListBlock(int blockNum) throws IOException { Integer key= new Integer(blockNum); Block block= (Block) blockCache.get(key); if (block != null && block instanceof FileListBlock) return (FileListBlock) block; FileListBlock fileListBlock= new FileListBlock(IIndexConstants.BLOCK_SIZE); fileListBlock.read(raf, blockNum); blockCache.put(key, fileListBlock); return fileListBlock; }
public Pattern translate(String pattern, char escape) throws ExpressionEvaluationException { List<?> key = Arrays.asList(pattern, escape); Pattern result = null; synchronized (cache) { result = cache.get(key); } if (result == null) { String newPattern = getPatternString(pattern, escape); result = getPattern(newPattern, pattern, flags); synchronized (cache) { cache.put(key, result); } } return result; }
public Pattern translate(String pattern, char escape) throws ExpressionEvaluationException { List<?> key = Arrays.asList(pattern, escape); Pattern result = null; synchronized (cache) { result = cache.get(key); } if (result == null) { String newPattern = getPatternString(pattern, escape); result = getPattern(newPattern, pattern, flags); synchronized (cache) { cache.put(key, result); } } return result; }
public Pattern translate(String pattern, char escape) throws ExpressionEvaluationException { List<?> key = Arrays.asList(pattern, escape); Pattern result = null; synchronized (cache) { result = cache.get(key); } if (result == null) { String newPattern = getPatternString(pattern, escape); result = getPattern(newPattern, pattern, flags); synchronized (cache) { cache.put(key, result); } } return result; }
public static DecimalFormat getDecimalFormat(CommandContext context, String format) { DecimalFormat result = null; if (context != null) { if (context.globalState.decimalFormatCache == null) { context.globalState.decimalFormatCache = new LRUCache<String, DecimalFormat>(32); } else { result = context.globalState.decimalFormatCache.get(format); } } if (result == null) { result = new DecimalFormat(format); //TODO: could be locale sensitive result.setParseBigDecimal(true); if (context != null) { context.globalState.decimalFormatCache.put(format, result); } } return result; }