如何将节点worker_threads与电子结合使用?

时间:2019-05-13 22:25:54

标签: electron

当我尝试在我的电子项目中使用worker_threads时,第二个New Worker被称为我的应用程序崩溃并出现错误

private void employeeView(){
StringRequest stringRequest = new StringRequest(Request.Method.GET, urlString,
                new Response.Listener<String>() {
                    @Override
                    public void onResponse(String response) {
                        try {
                            JSONObject  jsonRootObject = new JSONObject(response);
                            JSONArray jsonArray = jsonRootObject.optJSONArray("employee");

                            for(int i=0; i < jsonArray.length(); i++){
                                JSONObject jsonObject = jsonArray.getJSONObject(i);

                                String name = jsonObject.getString("name").toString();
                                String desc = jsonObject.optString("department").toString();

                                Employee temp = new Employee(name,dept);
                                employeeList.add(temp);
                            }

                        } catch (JSONException e) {e.printStackTrace();}
                    }
                },
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError error) {
                        Toast.makeText(getApplicationContext(), "CONNECT ERROR", Toast.LENGTH_SHORT).show();
                    }
                });
        RequestQueue requestQueue = Volley.newRequestQueue(this);
        requestQueue.add(stringRequest);
    }
            EmployeeAdapter adapter = new EmployeeAdapter(employeeList, context);

            recyclerView.setAdapter(adapter);
}

当我在节点文档中测试示例时,它运行没有问题。 我不明白这些错误是什么意思,我做错了什么。

我在电子5和节点12上,并且我以https://github.com/maximegris/angular-electron作为起点

0 个答案:

没有答案
相关问题