public void clear() throws IOException, SimpleXAResourceException { persistentNodePool.clear(); persistentStringPool.clear(); }
public void close() { // Node pool try { persistentNodePool.close(); } catch (NodePoolException e) { logger.error("Unable to close node pool", e); } // String pool try { persistentStringPool.close(); } catch (StringPoolException e) { logger.error("Unable to close string pool", e); } }
public void delete() { // Node pool try { persistentNodePool.delete(); } catch (NodePoolException e) { logger.error("Unable to delete node pool", e); } // String pool try { persistentStringPool.delete(); } catch (StringPoolException e) { logger.error("Unable to delete string pool", e); } }
public long newBlankNode() throws NodePoolException { return persistentNodePool.newNode(); }
public ResolverSession newReadOnlyResolverSession() throws ResolverSessionFactoryException { try { logger.debug("Obtaining new RO XAResolverSession on SP/NP : " + persistentStringPool.getClass()); return new StringPoolSession(databaseURI, hostnameAliases, persistentStringPool.newReadOnlyStringPool(), persistentNodePool.newReadOnlyNodePool(), temporaryStringPoolFactory.newStringPool(), temporaryNodePoolFactory.newNodePool(), persistentStringPool); } catch (StringPoolException es) { throw new ResolverSessionFactoryException("Unable to obtain new StringPool", es); } catch (NodePoolException en) { throw new ResolverSessionFactoryException("Unable to obtain new NodePool", en); } }
public ResolverSession newWritableResolverSession() throws ResolverSessionFactoryException { try { logger.debug("Obtaining new RW XAResolverSession on SP/NP : " + persistentStringPool.getClass()); return new StringPoolSession(databaseURI, hostnameAliases, persistentStringPool.newWritableStringPool(), persistentNodePool.newWritableNodePool(), temporaryStringPoolFactory.newStringPool(), temporaryNodePoolFactory.newNodePool(), persistentStringPool); } catch (StringPoolException es) { throw new ResolverSessionFactoryException("Unable to obtain new StringPool", es); } catch (NodePoolException en) { throw new ResolverSessionFactoryException("Unable to obtain new NodePool", en); } }
public void prepare() throws SimpleXAResourceException { if (logger.isDebugEnabled()) { logger.debug("Preparing phase on StringPoolSession " + System.identityHashCode(this) + " SP=" + System.identityHashCode(persistentStringPool)); } if (state == PREPARE) { return; } else if (state != OBTAIN) { throw new SimpleXAResourceException("Attempting to prepare phase without obtaining phase"); } state = PREPARE; persistentStringPool.prepare(); persistentNodePool.prepare(); for (int i = 0; i < resources.length; i++) { resources[i].prepare(); } }
public void commit() throws SimpleXAResourceException { if (logger.isDebugEnabled()) { logger.debug("Committing phase on StringPoolSession " + System.identityHashCode(this)); } if (state == COMMIT) { return; } else if (state != PREPARE) { throw new SimpleXAResourceException("Attempting to commit phase without preparing"); } state = COMMIT; synchronized (globalLock) { persistentStringPool.commit(); persistentNodePool.commit(); for (int i = 0; i < resources.length; i++) { resources[i].commit(); } } }
public int[] recover() throws SimpleXAResourceException { int[] nodePhases = persistentNodePool.recover(); int[] stringPhases = persistentStringPool.recover(); // If both are empty then return empty. if (nodePhases.length == 0 && stringPhases.length == 0) { return nodePhases; } // Else if the intersection is empty *error*, TIntHashSet phaseSet = new TIntHashSet(nodePhases); phaseSet.retainAll(stringPhases); if (phaseSet.isEmpty()) { throw new SimpleXAResourceException("No matching phases between Node and String Pools."); } //else return the intersection. return phaseSet.toArray(); }
persistentNodePool.addNewNodeListener(persistentStringPool);
/** * Allocates new node IDs for unknown nodes. Stores node IDs for later lookups. * @param bn The blank node to get the ID for. * @param flags Indicates the type of storage for the node ids. * @return The node ID for this given blank node. * @throws NodePoolException An error while allocating a new node. */ protected long getAllocatedNodeId(BNode bn, int flags) throws NodePoolException { assert !(bn instanceof BlankNodeImpl); long nodeId; if ((flags & STORE_MASK) == TEMP) { nodeId = -temporaryNodePool.newNode(); } else { nodeId = persistentNodePool.newNode(); } return nodeId; }
/** * Creates a new Read Only ResolverSession that supports JRDF. * * @throws ResolverSessionFactoryException * @return ResolverSession */ public ResolverSession newReadOnlyResolverSession() throws ResolverSessionFactoryException { try { logger.debug("Obtaining new RO XAResolverSession on SP/NP : " + sessionFactory.getPersistentStringPool().getClass()); return new JRDFResolverSession(databaseURI, hostnameAliases, sessionFactory.getPersistentStringPool().newReadOnlyStringPool(), sessionFactory.getPersistentNodePool().newReadOnlyNodePool(), sessionFactory.getTemporaryStringPoolFactory().newStringPool(), sessionFactory.getTemporaryNodePoolFactory().newNodePool(), sessionFactory.getGlobalLock()); } catch (StringPoolException es) { throw new ResolverSessionFactoryException("Unable to obtain new StringPool", es); } catch (NodePoolException en) { throw new ResolverSessionFactoryException("Unable to obtain new NodePool", en); } }
/** * Creates a new Read/Write ResolverSession that supports JRDF. * * @throws ResolverSessionFactoryException * @return ResolverSession */ public ResolverSession newWritableResolverSession() throws ResolverSessionFactoryException { try { logger.debug("Obtaining new RW XAResolverSession on SP/NP : " + sessionFactory.getPersistentStringPool().getClass()); return new JRDFResolverSession(databaseURI, hostnameAliases, sessionFactory.getPersistentStringPool().newWritableStringPool(), sessionFactory.getPersistentNodePool().newWritableNodePool(), sessionFactory.getTemporaryStringPoolFactory().newStringPool(), sessionFactory.getTemporaryNodePoolFactory().newNodePool(), sessionFactory.getGlobalLock()); } catch (StringPoolException es) { throw new ResolverSessionFactoryException("Unable to obtain new StringPool", es); } catch (NodePoolException en) { throw new ResolverSessionFactoryException("Unable to obtain new NodePool", en); } }
localNode = persistentNodePool.newNode(); persistentStringPool.put(localNode, relativeSPObject); if (logger.isDebugEnabled()) {
public void clear(int phaseNumber) throws IOException, SimpleXAResourceException { persistentNodePool.clear(phaseNumber); persistentStringPool.clear(phaseNumber); } }