vendredi 8 mai 2015

AWS SDK - AmazonS3Client doesn't shutdown

I find that creating an AmazonS3Client means my process hangs around even when it's doing nothing. I'm doing a file upload, but I've trimmed it down to just this.

When I run the following code (with working credentials) it prints "Simple is finished" but the process doesn't exit until eventually I get

Simple is finished
[WARNING] thread Thread[java-sdk-http-connection-reaper,5,Simple] was interrupted but is still alive after waiting at least 15000msecs
[WARNING] thread Thread[java-sdk-http-connection-reaper,5,Simple] will linger despite being asked to die via interruption
[WARNING] NOTE: 1 thread(s) did not finish despite being asked to  via interruption. This is not a problem with exec:java, it is a problem with the running code. Although not serious, it should be remedied.
[WARNING] Couldn't destroy threadgroup org.codehaus.mojo.exec.ExecJavaMojo$IsolatedThreadGroup[name=Simple,maxpri=10]
java.lang.IllegalThreadStateException

The code:

    import com.amazonaws.auth.AWSCredentials;
    import com.amazonaws.auth.BasicAWSCredentials;
    import com.amazonaws.services.s3.AmazonS3;
    import com.amazonaws.services.s3.AmazonS3Client;

    public class Simple {

        private static String accessKey = "XXX";
        private static String secretKey = "ZZZ";

        public static void main(String[] args) {

            AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey);
            AmazonS3 s3client = new AmazonS3Client(credentials);
            System.out.println("Simple is finished");        
        }

    }

Is it supposed to work like this? Is there a way to kill it off?




Aucun commentaire:

Enregistrer un commentaire