java - AWS SDK - AmazonS3Client doesn't shutdown -


i find creating amazons3client means process hangs around when it's doing nothing. i'm doing file upload, i've trimmed down this.

when run following code (with working credentials) prints "simple finished" process doesn't exit until maven:exec tells me:

simple finished [warning] thread thread[java-sdk-http-connection-reaper,5,simple] interrupted still alive after waiting @ least 15000msecs [warning] thread thread[java-sdk-http-connection-reaper,5,simple] linger despite being asked die via interruption [warning] note: 1 thread(s) did not finish despite being asked  via interruption. not problem exec:java, problem running code. although not serious, should 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 finished");                 }      } 

is supposed work this? there way kill off?

edit: add version information:

<dependency>     <groupid>com.amazonaws</groupid>     <artifactid>aws-java-sdk</artifactid>     <version>1.9.33</version> </dependency> 

either of these seems work:

((amazons3client) s3client).shutdown(); 

or

try {     com.amazonaws.http.idleconnectionreaper.shutdown(); } catch (throwable t) {     // etc } 

although i'm not sure how correct are.


Comments