Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/main/java/com/marklogic/contentpump/InputType.java
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,10 @@ public void applyConfigOptions(Configuration conf, CommandLine cmdline)
ContentSource cs;
String[] outputHosts =
conf.getStrings(MarkLogicConstants.OUTPUT_HOST);
if (outputHosts == null || outputHosts.length == 0) {
throw new IllegalArgumentException(MarkLogicConstants.OUTPUT_HOST +
" is not specified.");
}
int hostIdx = 0;
while (hostIdx < outputHosts.length) {
try {
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/com/marklogic/contentpump/RDFReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -546,8 +546,13 @@ public void initExistingMapPerms() throws IOException {
ResultSequence result = null;
ContentSource cs;
try {
String[] hosts = conf.getStrings(MarkLogicConstants.OUTPUT_HOST);
if (hosts == null || hosts.length == 0) {
throw new IllegalArgumentException(MarkLogicConstants.OUTPUT_HOST +
" is not specified.");
}
cs = InternalUtilities.getOutputContentSource(conf,
conf.getStrings(MarkLogicConstants.OUTPUT_HOST)[0]);
hosts[0]);
session = cs.newSession();
RequestOptions options = new RequestOptions();
options.setDefaultXQueryVersion("1.0-ml");
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/com/marklogic/contentpump/ThreadManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -548,14 +548,19 @@ public void run() {
boolean isRetryable = false;
pollingRetry = 0;
pollingSleepTime = MIN_SLEEP_TIME;
String[] hosts = conf.getStrings(MarkLogicConstants.OUTPUT_HOST);
if (hosts == null || hosts.length == 0) {
LOG.error(MarkLogicConstants.OUTPUT_HOST + " is not specified.");
job.setJobState(JobStatus.State.FAILED);
return;
}
// Poll server max threads
while (pollingRetry < MAX_RETRIES) {
if (pollingRetry > 0) {
if (LOG.isDebugEnabled()) {
LOG.debug("Retrying querying available server max threads.");
}
}
String[] hosts = conf.getStrings(MarkLogicConstants.OUTPUT_HOST);
for (String host : hosts) {
try {
ContentSource cs = InternalUtilities.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ private LinkedMapWritable getMimetypesMap() throws IOException {
return mimetypeMap;
}
String[] hosts = conf.getStrings(OUTPUT_HOST);
if (hosts == null || hosts.length == 0) {
throw new IllegalArgumentException(OUTPUT_HOST +
" is not specified.");
}
Session session = null;
ResultSequence result = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,13 @@ public static List<ContentPermission> getDefaultPermissions(Configuration conf,
ResultSequence result = null;
ContentSource cs;
try {
String[] hosts = conf.getStrings(MarkLogicConstants.OUTPUT_HOST);
if (hosts == null || hosts.length == 0) {
throw new IllegalArgumentException(MarkLogicConstants.OUTPUT_HOST +
" is not specified.");
}
cs = InternalUtilities.getOutputContentSource(conf,
conf.getStrings(MarkLogicConstants.OUTPUT_HOST)[0]);
hosts[0]);

session = cs.newSession();
RequestOptions options = new RequestOptions();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,10 @@ public void checkOutputSpecs(
TextArrayWritable hostArray = null;
if (restrictHosts) {
String[] outputHosts = conf.getStrings(OUTPUT_HOST);
if (outputHosts == null || outputHosts.length == 0) {
throw new IllegalArgumentException(OUTPUT_HOST +
" is not specified.");
}
hostArray = new TextArrayWritable(outputHosts);
} else {
String outputHost = cs.getConnectionProvider().getHostName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,12 @@ public class InternalUtilities implements MarkLogicConstants {
*/
public static ContentSource getInputContentSource(Configuration conf)
throws URISyntaxException, XccConfigException, IOException {
String host = conf.getStrings(INPUT_HOST)[0];
if (host == null || host.isEmpty()) {
String[] hosts = conf.getStrings(INPUT_HOST);
if (hosts == null || hosts.length == 0) {
throw new IllegalArgumentException(INPUT_HOST +
" is not specified.");
}

return getInputContentSource(conf, host);
return getInputContentSource(conf, hosts[0]);
}

/**
Expand Down