如何避免"等待信号量时中断" servlet中的异常?

时间:2015-04-12 15:41:37

标签: java jsp google-app-engine servlets google-drive-api

我正在尝试在 Google云端硬盘上传字节数组内容 为此,我在jsp中初始化了 Drive 类。然后,我将Drive的对象放到 Processer 类中进行进一步处理。该类以字节数组的形式下载文件并将其上传到Google云端硬盘。 但是,它显示例外:

service.files().insert(body, new ByteArrayContent("application/vnd.google-app.file", bytes)).execute();  

异常堆栈跟踪:

java.lang.RuntimeException: Interrupted while waiting on semaphore:
at com.google.appengine.tools.development.ApiProxyLocalImpl.makeAsyncCall(ApiProxyLocalImpl.java:188)
at com.google.appengine.tools.development.ApiProxyLocalImpl.makeSyncCall(ApiProxyLocalImpl.java:151)
at com.google.apphosting.api.ApiProxy.makeSyncCall(ApiProxy.java:120)
at com.google.appengine.api.urlfetch.URLFetchServiceImpl.fetch(URLFetchServiceImpl.java:38)
at com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler$Connection.fetchResponse(URLFetchServiceStreamHandler.java:417)
at com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler$Connection.getInputStream(URLFetchServiceStreamHandler.java:296)
at com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler$Connection.getResponseCode(URLFetchServiceStreamHandler.java:149)
at com.google.api.client.http.javanet.NetHttpResponse.<init>(NetHttpResponse.java:36)
at com.google.api.client.http.javanet.NetHttpRequest.execute(NetHttpRequest.java:94)
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:965)
at com.google.api.client.googleapis.media.MediaHttpUploader.executeCurrentRequestWithoutGZip(MediaHttpUploader.java:545)
at com.google.api.client.googleapis.media.MediaHttpUploader.executeCurrentRequest(MediaHttpUploader.java:562)
at com.google.api.client.googleapis.media.MediaHttpUploader.executeUploadInitiation(MediaHttpUploader.java:519)
at com.google.api.client.googleapis.media.MediaHttpUploader.resumableUpload(MediaHttpUploader.java:384)
at com.google.api.client.googleapis.media.MediaHttpUploader.upload(MediaHttpUploader.java:336)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:418)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:343)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460)
at com.rapps.splitingtool.Processer.run(Processer.java:135)
at com.google.appengine.tools.development.RequestThreadFactory$1$1$2.run(RequestThreadFactory.java:110)
at java.security.AccessController.doPrivileged(Native Method)
at com.google.appengine.tools.development.RequestThreadFactory$1$1.run(RequestThreadFactory.java:107)

Caused by: java.lang.InterruptedException
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1301)
at java.util.concurrent.Semaphore.acquire(Semaphore.java:317)
at com.google.appengine.tools.development.ApiProxyLocalImpl.makeAsyncCall(ApiProxyLocalImpl.java:185)
... 21 more

请帮帮我。我很迷惑。

感谢您的帮助!

0 个答案:

没有答案