Last active
September 14, 2016 15:54
-
-
Save csjx/7042c40dbab58e20c0cbd9412aced863 to your computer and use it in GitHub Desktop.
An example showing http connection timeout issues with d1_libclient_java v2.2.0, httpclient 4.3.6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.dataone.tests; | |
import java.io.InputStream; | |
import java.util.ArrayList; | |
import java.util.List; | |
import org.dataone.client.v2.itk.D1Client; | |
import org.dataone.client.v2.MNode; | |
import org.dataone.service.exceptions.BaseException; | |
import org.dataone.service.exceptions.ServiceFailure; | |
import org.dataone.service.types.v1.Identifier; | |
import org.dataone.service.types.v2.SystemMetadata; | |
public class D1LibclientTimeoutTest { | |
public static void main(String[] args) { | |
List<String> pidStrs = new ArrayList<String>(); | |
pidStrs.add("urn:uuid:5fec991c-95bc-45d3-a253-24f4b26fe37e"); | |
pidStrs.add("urn:uuid:58c2a79c-3058-48c9-bffc-54e8b2ea5f26"); | |
pidStrs.add("urn:uuid:618dc687-e53f-4b7f-b52c-d810229bb1a1"); | |
pidStrs.add("urn:uuid:c16b08bd-8bf0-4def-a2f1-6d84aeb9ecdb"); | |
pidStrs.add("urn:uuid:30f50763-c28d-4544-854e-9da252ce19eb"); | |
pidStrs.add("urn:uuid:f5774a8a-d310-4a5e-bc69-b43e2d6826fb"); | |
pidStrs.add("urn:uuid:92c72bfb-597f-4279-b0df-8750f8a8f43c"); | |
pidStrs.add("urn:uuid:b03942f6-5cf4-44e3-a474-2ec56ce252a7"); | |
pidStrs.add("urn:uuid:c214de27-b791-4a37-971a-3d3e6eb65b17"); | |
pidStrs.add("urn:uuid:eb0557c7-ff97-4f7a-b8f6-b568ca8ba660"); | |
MNode sourceMN = null; | |
try { | |
sourceMN = D1Client.getMN("https://arcticdata.io/metacat/d1/mn"); | |
} catch (ServiceFailure e1) { | |
e1.printStackTrace(); | |
} | |
for ( String pidStr : pidStrs ) { | |
Identifier pid = new Identifier(); | |
pid.setValue(pidStr); | |
SystemMetadata sysmeta = null; | |
InputStream objectStream = null; | |
try { | |
// get the original system metadata | |
sysmeta = sourceMN.getSystemMetadata(null, pid); | |
// get the object | |
objectStream = sourceMN.get(null, pid); | |
} catch (BaseException e) { | |
System.out.println("Error calling the MN: " + e.getDescription()); | |
e.printStackTrace(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Result: