标签: rpc

检索数据时,带有ArrayList <SomeClass>的gwt asyncCallback失败

我正在尝试为我的进一步工作制作示例代码.我正在使用gwt vanillia和新的gwt.我的目的是填充一些文本框和网格.从数据库填充文本框,rpc调用没问题.但我不能通过使用RPC调用填充datagrid.我使用Bastian Tenbergen的教程 来填充一些文本框.但是当我尝试使用ArrayList使用异步回调填充网格时,代码失败了.我知道ArrayList也是可序列化的,但我无法解决这个问题.任何建议表示赞赏.这是我的任务的一些代码.在服务器包中:SqlDbConnection.java

    public ArrayList<hastaGrid> callGrid(String something){
    ArrayList<hastaGrid> list = new ArrayList<hastaGrid>();
    hastagrid hastaGrid = null;     
    try {
        Statement st = conn.createStatement();
        ResultSet result = st.executeQuery("select name from TEST where name = '"+ something +"'");

        while(result.next()) {
            hastagrid = new hastaGrid(result.getString(1), result.getString(2),result.getNString(2),result.getString(3));
            list.add(hastaGrid);
            System.out.println("result: " +hastagrid.getLogin().toString()+" " + hastagrid.getPassword() +" "+ hastagrid.getName() +" " + hastagrid.getSurname());
        }
        result.close();
        st.close();                 
    } catch (Exception e) {
        e.printStackTrace();
    }       
    return list;
}
Run Code Online (Sandbox Code Playgroud)

在客户端包中:hastaGrid.java //该类还有getter和setter方法.

public class hastaGrid implements IsSerializable {

private …
Run Code Online (Sandbox Code Playgroud)

gwt rpc asynchronous arraylist callback

0
推荐指数
1
解决办法
2986
查看次数

如何正确执行RPC样式的Asp.Net Web API调用?

更新9/12/2012:

我和同事分享了我的代码,第一次没有任何改变,一切正常.所以,我的盒子上一定有环保的东西,任何人有什么想法?

请参阅下面的更新

建立:

.Net 4.5

自托管(控制台应用程序).​​Net 4.5 Web API应用程序

使用MSTest测试线束

我的Web API应用程序大多充满了REST ApiControllers,它们都能正常运行,就像我期望的标准CRUD类型一样.现在我有一个要求(将一些对象添加到内部队列),这似乎不适合REST CRUD模型.我发现这篇文章似乎说你可以在Web API中做RPC样式的非REST操作就好了.

我写了一个新的控制器,看起来像这样:

public class TaskInstanceQueueController : ApiController
{
    public void Queue(TaskInstance taskInstance)
    {
        // Do something with my taskInstance
        Console.WriteLine("Method entered!");
    }
}
Run Code Online (Sandbox Code Playgroud)

在我调用它的代理类中,我有如下代码:

public class TaskInstanceQueueProxy : ITaskInstanceQueueProxy
{
    readonly HttpClient _client = new HttpClient();

    public TaskInstanceQueueProxy()
    {
        var apiBaseUrl = System.Configuration.ConfigurationManager.AppSettings["APIBaseUrl"];
        _client.BaseAddress = new Uri(apiBaseUrl);
        _client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
    }

    public void QueueTaskInstances(TaskInstance taskInstance)
    {
        QueueTaskInstanceViaAPI(taskInstance);
    }

    private async void QueueTaskInstanceViaAPI(TaskInstance taskInstance)
    { …
Run Code Online (Sandbox Code Playgroud)

asp.net rest rpc asp.net-web-api

0
推荐指数
1
解决办法
7783
查看次数

如何杀死尚未完成的GWT RPC

我的代码是用于向多个用户发送电子邮件.用户将点击发送按钮,并将调用rpc.现在,如果用户点击取消按钮.应该取消正在进行的rpc..有人可以帮忙吗?

我搜索了很多,他们介绍了Request Builder的概念.但我没有得到任何完美的想法.

gwt rpc gwt-rpc

0
推荐指数
1
解决办法
629
查看次数

gprc 客户端异步响应 NodeJS

我试图在函数中调用一个简单的 grpc 请求,但我不知道如何等待响应并将其传递到 grpc 调用之外。

应该是这样的:

Client: (parent, args, context, info) =>{
      client.Get({thing, objects, properties}, function(err, response) {
            //how to return the response outside?
          });
      //await for the response function.
};
Run Code Online (Sandbox Code Playgroud)

是否可以在 client.Get 函数之外以某种方式返回响应?有人有一些建议吗?谢谢您的建议!

rpc node.js async-await grpc graphql

0
推荐指数
1
解决办法
5823
查看次数

尝试更新地图时的竞争条件

介绍

我正在尝试在 /go 中构建客户端服务器应用程序。

服务器只有一个实例,其中包含任务列表,这些任务只是字符串数据。服务器维护任务映射及其分配状态。

另一方面,客户端可以有多个实例,并向服务器请求任务。当分配任务时,服务器将分配状态更新为 true。

客户端和服务器之间的通信是通过go rpc进行的。

请参考这个图表为了更好的理解。

为了模拟多个客户端,我在单个应用程序中启动多个 go 例程,向服务器发出请求。

代码

服务器

package main

import (
    "fmt"
    "log"
    "net/http"
    "net/rpc"
    "sync"
)

type Container struct {
    mu   sync.Mutex
    list map[string]bool
}

var ListOfTasks Container

func (c *Container) UpdateList() string {
    var t string
    ListOfTasks.mu.Lock()
    defer ListOfTasks.mu.Unlock()
    for k, v := range c.list {
        if !v {
            c.list[k] = true
            fmt.Println("Task Name", k)
            return k
        }
    }
    return t
}

// RPC Code
type RPCServer struct{}

type …
Run Code Online (Sandbox Code Playgroud)

rpc go race-condition goroutine

0
推荐指数
1
解决办法
172
查看次数

为什么malloc在这里引起内存损坏?

我不断收到以下错误:

*** Error in `./vice': malloc(): memory corruption: 0x08e77530 ***
Aborted (core dumped)
Run Code Online (Sandbox Code Playgroud)

相关代码为:

open_result *
open_file_1_svc(open_args *argp, struct svc_req *rqstp)
{
    static open_result  result;
    int obtained_fd;
    int just_read;
    int total_read = 0;
    int max_bytes_read = 1024;
    char *ptr_file;
    char *pathName = "MyFiles/"; // strlen = 8
    int toReserve;

    xdr_free((xdrproc_t)xdr_open_result, (char *)&result);

    // Construct full name of the file (in "MyFiles")
    toReserve = strlen(argp->fname) + strlen(pathName) + 1; // "\0"
    char *fullName = malloc(toReserve*sizeof(char));
    fullName = strdup(pathName);
    fullName = strcat(fullName, …
Run Code Online (Sandbox Code Playgroud)

c malloc rpc memory-management memory-corruption

-3
推荐指数
1
解决办法
3847
查看次数