| | |
| | | //The substring buffer manager to use. |
| | | private BufferManager bufferMgr; |
| | | |
| | | //Flag set when substring buffer should be flushed. |
| | | private boolean flushBuffer = true; |
| | | |
| | | /** |
| | | * Create a work thread instance using the specified parameters. |
| | | * |
| | |
| | | stopRequested = true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Tells thread to flush substring buffer. |
| | | * |
| | | * @param flush Set to false if substring flush should be skipped. |
| | | */ |
| | | void setFlush(boolean flush) { |
| | | this.flushBuffer = flush; |
| | | } |
| | | /** |
| | | * Run the thread. Read from item from queue and give it to the |
| | | * buffer manage, unless told to stop. Once stopped, ask buffer manager |
| | |
| | | } |
| | | } |
| | | } while (!stopRequested); |
| | | if(flushBuffer) { |
| | | bufferMgr.flushAll(threadNumber); |
| | | } |
| | | } catch (Exception e) { |
| | | if (debugEnabled()) { |
| | | TRACER.debugCaught(DebugLogLevel.ERROR, e); |
| | |
| | | IDs.set(0, entryID); |
| | | } |
| | | else { |
| | | EntryID nodeID; |
| | | IDs = new ArrayList<EntryID>(entryDN.getNumComponents()); |
| | | IDs.add(entryID); |
| | | if (parentID != null) |
| | |
| | | EntryContainer ec = context.getEntryContainer(); |
| | | for (DN dn = ec.getParentWithinBase(parentDN); dn != null; |
| | | dn = ec.getParentWithinBase(dn)) { |
| | | EntryID nodeID = dn2id.get(txn, dn); |
| | | IDs.add(nodeID); |
| | | if((nodeID = getAncestorID(dn2id, dn, txn)) == null) { |
| | | return false; |
| | | } else { |
| | | IDs.add(nodeID); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | return true; |
| | | } |
| | | |
| | | private EntryID getAncestorID(DN2ID dn2id, DN dn, Transaction txn) |
| | | throws DatabaseException { |
| | | int i=0; |
| | | EntryID nodeID = dn2id.get(txn, dn); |
| | | if(nodeID == null) { |
| | | while((nodeID = dn2id.get(txn, dn)) == null) { |
| | | try { |
| | | Thread.sleep(50); |
| | | if(i == 3) { |
| | | return null; |
| | | } |
| | | i++; |
| | | } catch (Exception e) { |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | | return nodeID; |
| | | } |
| | | |
| | | /** |
| | | * Process the a entry from the work element into the dn2id DB. |
| | | * |