List of usage examples for com.google.common.hash Funnels longFunnel
public static Funnel<Long> longFunnel()
From source file:com.github.benmanes.caffeine.cache.simulator.membership.bloom.GuavaBloomFilter.java
private BloomFilter<Long> makeBloomFilter() { return BloomFilter.create(Funnels.longFunnel(), expectedInsertions, fpp); }
From source file:org.veronicadb.core.diskgraph.VDiskGraphShard.java
public VDiskGraphShard(long shardId, int shardSize) { super(shardId, shardSize); this.shardBloom = BloomFilter.create(Funnels.longFunnel(), shardSize, 0.0001); this.cache = new LinkedHashMap<String, VVertex>((int) (shardSize / 0.40), 0.75f, true); this.shardFileLocation = CONFIG_STORAGE_DIRECTORY + "/" + shardId; this.fileReadPointers = new ArrayBlockingQueue<RandomAccessFile>(10, true); this.elementLocks = new HashSet<Long>(); this.vertexIndexHash = new ConcurrentHashMap<Long, Long>(shardSize); }
From source file:org.veronicadb.core.memorygraph.VSubGraph.java
public VSubGraph(long graphId, int shardSize) { super(graphId, shardSize); shardVertices = new ConcurrentHashMap<Long, VVertex>(); subGraphBloom = BloomFilter.create(Funnels.longFunnel(), shardSize, 0.0001); isReadOnly().set(false);//from w w w . ja v a2s . c o m }
From source file:org.veronicadb.core.memorygraph.VSubGraph.java
/** * Re-initialize bloomfilter from bytes/*w ww .j a v a 2 s. c o m*/ * @param bloomBytes * @throws IOException */ protected void loadBloom(byte[] bloomBytes) throws IOException { subGraphBloom = BloomFilter.readFrom(new ByteArrayInputStream(bloomBytes), Funnels.longFunnel()); }
From source file:org.apache.marmotta.kiwi.persistence.KiWiConnection.java
public KiWiConnection(KiWiPersistence persistence, KiWiDialect dialect, CacheManager cacheManager) throws SQLException { this.cacheManager = cacheManager; this.dialect = dialect; this.persistence = persistence; this.commitLock = new ReentrantLock(); this.literalLock = new ReentrantLock(); this.uriLock = new ReentrantLock(); this.bnodeLock = new ReentrantLock(); this.batchCommit = dialect.isBatchSupported(); this.deletedStatementsLog = BloomFilter.create(Funnels.longFunnel(), 100000); this.transactionId = getNextSequence(); initCachePool();/* www . j a v a2 s . c o m*/ initStatementCache(); }
From source file:org.apache.marmotta.kiwi.persistence.KiWiConnection.java
/** * Makes all changes made since the previous * commit/rollback permanent and releases any database locks * currently held by this <code>Connection</code> object. * This method should be/*from w ww . j a v a2 s . c o m*/ * used only when auto-commit mode has been disabled. * * @exception java.sql.SQLException if a database access error occurs, * this method is called while participating in a distributed transaction, * if this method is called on a closed conection or this * <code>Connection</code> object is in auto-commit mode * @see #setAutoCommit */ public synchronized void commit() throws SQLException { numberOfCommits++; RetryExecution execution = new RetryExecution("COMMIT"); execution.execute(connection, new RetryCommand<Void>() { @Override public Void run() throws SQLException { if (tripleBatch != null && tripleBatch.size() > 0) { flushBatch(); } deletedStatementsLog = BloomFilter.create(Funnels.longFunnel(), 100000); if (connection != null) { connection.commit(); } return null; } }); this.transactionId = getNextSequence(); }
From source file:org.apache.marmotta.kiwi.persistence.KiWiConnection.java
/** * Undoes all changes made in the current transaction * and releases any database locks currently held * by this <code>Connection</code> object. This method should be * used only when auto-commit mode has been disabled. * * @exception java.sql.SQLException if a database access error occurs, * this method is called while participating in a distributed transaction, * this method is called on a closed connection or this * <code>Connection</code> object is in auto-commit mode * @see #setAutoCommit//from w w w. j av a 2 s. c o m */ public void rollback() throws SQLException { if (tripleBatch != null && tripleBatch.size() > 0) { synchronized (tripleBatch) { for (KiWiTriple triple : tripleBatch) { triple.setId(-1L); } tripleBatch.clear(); } } deletedStatementsLog = BloomFilter.create(Funnels.longFunnel(), 100000); if (connection != null && !connection.isClosed()) { connection.rollback(); } this.transactionId = getNextSequence(); }