Google云端硬盘REST-API内部错误500

时间:2016-06-22 12:13:39

标签: multithreading performance google-drive-api httprequest internal-server-error

我正在开发一个应用程序,它接收包含20-30个gmail地址的多个按摩队列。我的应用程序拥有一个google驱动器文件夹,必须与所有用户共享。我的应用程序使用Google驱动程序Java客户端,而我正在使用Google batching

进行HTTP调用

问题是当我尝试通过多线程同时与30个用户共享文件夹时,我收到内部错误500。但是,当我使用线程同步时,一切都很好但是每个用户的性能差不多大约0.5秒!

任何人都可以解释为什么我收到此错误?

500 OK
        {
        "code" : 500,
        "errors" : [ {
        "domain" : "global",
        "message" : "Internal Error. User message: \"An internal                                                     error has occurred which prevented the sharing of these item(s): fileame\"",
       "reason" : "internalError"
        } ],
      "message" : "Internal Error. User message: \"An internal error has occurred which prevented the sharing of these item(s): filename\""
        }

这是线程代码:

try {
        //batch start
        BatchRequest batch = service.batch();
        ArrayList<String> users = readUsers(this.file);
        Permission[] permissions= new Permission[users.size()];
        for (int i = 0 ; i < users.size(); i++){
           permissions[i]= new Permission();
           permissions[i].setValue(users.get(i)+"@gmail.com");
           permissions[i].setType("user");
           permissions[i].setRole("writer");
           service.permissions().insert(fileId, permissions[i]).setSendNotificationEmails(Boolean.FALSE)                    .queue(batch, callback);                  
        }
        //batch execute
       batch.execute();
    } catch (IOException e) {
        System.out.println("An error occurred and I am " + id + ": " + e);
    }

0 个答案:

没有答案