| | |
| | | private short protocolVersion = -1; |
| | | private boolean suspended; |
| | | private boolean shutdown; |
| | | private PersistentSearch mypsearch; |
| | | |
| | | /** |
| | | * Create a ServerWriter. |
| | |
| | | { |
| | | super(session, (short)-1, handler, replicationServerDomain); |
| | | |
| | | setName("Replication ECL Writer Thread for op:" + |
| | | setName("Replication ECL Writer Thread for operation " + |
| | | handler.getOperationId()); |
| | | |
| | | this.session = session; |
| | |
| | | this.protocolVersion = handler.getProtocolVersion(); |
| | | this.suspended = false; |
| | | this.shutdown = false; |
| | | |
| | | // Look for the psearch object related to this operation , the one that |
| | | // will ne notified with new entries to be returned. |
| | | ECLWorkflowElement wfe = (ECLWorkflowElement) |
| | | DirectoryServer.getWorkflowElement( |
| | | ECLWorkflowElement.ECL_WORKFLOW_ELEMENT); |
| | | for (PersistentSearch psearch : wfe.getPersistentSearches()) |
| | | { |
| | | if (psearch.getSearchOperation().toString().equals( |
| | | handler.getOperationId())) |
| | | { |
| | | mypsearch = psearch; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | if (shutdown) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | // Not suspended |
| | | doIt(); |
| | | |
| | | |
| | | if (shutdown) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | suspendWriter(); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * Loop gettting changes from the domain and publishing them either to |
| | | * Loop geting changes from the domain and publishing them either to |
| | | * the provided session or to the ECL session interface. |
| | | * @throws IOException when raised (connection closure) |
| | | * @throws InterruptedException when raised |
| | |
| | | { |
| | | try |
| | | { |
| | | handler.refreshEligibleCN(); |
| | | update = handler.takeECLUpdate(); |
| | | } |
| | | catch(DirectoryException de) |
| | |
| | | throws IOException |
| | | { |
| | | if (debugEnabled()) |
| | | TRACER.debugInfo(this + " publishes msg=[" + msg.toString() + "]"); |
| | | TRACER.debugInfo(this.getName() + |
| | | " publishes msg=[" + msg.toString() + "]"); |
| | | |
| | | if (session!=null) |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | ECLWorkflowElement wfe = (ECLWorkflowElement) |
| | | DirectoryServer.getWorkflowElement( |
| | | ECLWorkflowElement.ECL_WORKFLOW_ELEMENT); |
| | | |
| | | // Notify persistent searches. |
| | | for (PersistentSearch psearch : wfe.getPersistentSearches()) |
| | | if (mypsearch != null) |
| | | { |
| | | try |
| | | { |
| | | Entry eclEntry = ECLSearchOperation.createEntryFromMsg(msg); |
| | | psearch.processAdd(eclEntry, -1); |
| | | mypsearch.processAdd(eclEntry, -1); |
| | | } |
| | | catch(Exception e) |
| | | { |
| | |
| | | ERR_WRITER_UNEXPECTED_EXCEPTION.get(handler.toString() + |
| | | " " + stackTraceToSingleLineString(e)); |
| | | logError(errMessage); |
| | | mypsearch.cancel(); |
| | | } |
| | | } |
| | | } |