Amazon s3 バケットからファイルを送受信する基本的な方法を書いています。これが私のメソッドの関連コードです。「key」は S3 名で、「saveStream」は InputStream です。
Upload myUpload = transferManager.upload(daqBucketName, key, saveStream, metadata);
try {
myUpload.waitForCompletion();
saveStream.close();
} catch (InterruptedException e) {
key = null;
e.printStackTrace();
} catch (AmazonServiceException e) {
key = null;
e.printStackTrace();
} catch (AmazonClientException e) {
key = null;
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
finally {
if (saveStream != null) {
try {
saveStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return key;
}
ストリームは正常にアップロードされますが、プログラムの完了を停止するスレッドがあります (プログラムは実行されたままになります)。何がうまくいかないのですか?jstackダンプは次のとおりです。
"Attach Listener" daemon prio=10 tid=0x6a403c00 nid=0x2019 runnable [0x00000000]
java.lang.Thread.State: RUNNABLE
"DestroyJavaVM" prio=10 tid=0xb6609400 nid=0x1b51 waiting on condition [0x00000000]
java.lang.Thread.State: RUNNABLE
"s3-transfer-manager-worker-1" prio=10 tid=0x695d1800 nid=0x1b5f waiting on condition [0x68efe000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x9f3a2178> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2043)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:386)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1043)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1103)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:679)
"java-sdk-http-connection-reaper" daemon prio=10 tid=0x69551800 nid=0x1b5e waiting on condition [0x69292000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at com.amazonaws.http.IdleConnectionReaper.run(IdleConnectionReaper.java:75)
"Low Memory Detector" daemon prio=10 tid=0xb66cb000 nid=0x1b5c runnable [0x00000000]
java.lang.Thread.State: RUNNABLE
"C2 CompilerThread1" daemon prio=10 tid=0xb66c9400 nid=0x1b5b waiting on condition [0x00000000]
java.lang.Thread.State: RUNNABLE
"C2 CompilerThread0" daemon prio=10 tid=0xb66c7400 nid=0x1b5a waiting on condition [0x00000000]
java.lang.Thread.State: RUNNABLE
"Signal Dispatcher" daemon prio=10 tid=0xb66c6000 nid=0x1b59 runnable [0x00000000]
java.lang.Thread.State: RUNNABLE
"Finalizer" daemon prio=10 tid=0xb66b6400 nid=0x1b58 in Object.wait() [0x6ae7d000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x9f2a02c0> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:133)
- locked <0x9f2a02c0> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:149)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:177)
"Reference Handler" daemon prio=10 tid=0xb66b4c00 nid=0x1b57 in Object.wait() [0x6a7eb000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x9f2a4038> (a java.lang.ref.Reference$Lock)
at java.lang.Object.wait(Object.java:502)
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:133)
- locked <0x9f2a4038> (a java.lang.ref.Reference$Lock)
"VM Thread" prio=10 tid=0xb66b1000 nid=0x1b56 runnable
"GC task thread#0 (ParallelGC)" prio=10 tid=0xb6610800 nid=0x1b52 runnable
"GC task thread#1 (ParallelGC)" prio=10 tid=0xb6611c00 nid=0x1b53 runnable
"GC task thread#2 (ParallelGC)" prio=10 tid=0xb6613400 nid=0x1b54 runnable
"GC task thread#3 (ParallelGC)" prio=10 tid=0xb6614c00 nid=0x1b55 runnable
"VM Periodic Task Thread" prio=10 tid=0xb66cd400 nid=0x1b5d waiting on condition
JNI global references: 1641