File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
src/main/groovy/com/marklogic/gradle/task/datamovement Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -11,12 +11,17 @@ import com.marklogic.client.ext.datamovement.listener.SimpleBatchLoggingListener
1111import com.marklogic.gradle.task.MarkLogicTask
1212import org.gradle.api.GradleException
1313
14+ /**
15+ * The "client" field in this task allows a user to provide a custom DatabaseClient while declaring an instance of
16+ * this task in a Gradle build file.
17+ */
1418class DataMovementTask extends MarkLogicTask {
1519
20+ DatabaseClient client
21+
1622 void runQueryBatcherJob (QueryBatcherJob job ) {
1723 if (project. hasProperty(" jobProperties" )) {
1824 if (job instanceof ConfigurableJob ) {
19- ConfigurableJob cjob = (ConfigurableJob ) job
2025 printJobProperties(job)
2126 } else {
2227 println " Job does not implement ConfigurableJob, cannot show its properties"
@@ -50,11 +55,16 @@ class DataMovementTask extends MarkLogicTask {
5055 }
5156 }
5257
53- DatabaseClient client = newClient()
58+ DatabaseClient databaseClient = client
59+ if (databaseClient == null ) {
60+ databaseClient = newClient()
61+ }
5462 try {
55- job. run(client )
63+ job. run(databaseClient )
5664 } finally {
57- client. release()
65+ if (databaseClient != null ) {
66+ databaseClient. release()
67+ }
5868 }
5969 }
6070 }
You can’t perform that action at this time.
0 commit comments