关于apache Ignite服务实现
About apache Ignite service Implementation
如果我有接口
public interface TestService {
public String getSomething();
}
和一个class
import org.apache.ignite.services.Service;
import org.apache.ignite.services.ServiceContext;
public class TestServiceImpl implements Service, TestService {
@Override
public void init(ServiceContext ctx) throws Exception {
}
@Override
public void execute(ServiceContext ctx) throws Exception {
}
@Override
public void cancel(ServiceContext ctx) {
}
@Override
public String getSomething() {
return "HelloWorld";
}
}
我使用
在 ignite 服务器节点上部署此服务
// Deploy services only on server nodes.
IgniteServices serverSvcs = ignite.services(ignite.cluster().forServers());
// Deploy cluster singleton.
serverSvcs.deployClusterSingleton("TestService", new TestServiceImpl());
并且 Ignite 客户端节点尝试获取服务
TestService testSvc = mIgnite.services().serviceProxy("TestService", TestService.class, false);
如果客户端节点不包含 "TestServiceImpl" class,
将捕获异常消息:
"Failed to find class with given class loader for unmarshalling (make sure same versions of all classes are available on all nodes or enable peer-class-loading)",
ignite 客户端节点是否必须具有 class TestServiceImpl?
这已经修复,修复将在即将发布的 Ignite 1.6 中发布。同时,您可以下载每晚构建版本并检查它是否适合您:http://ignite.apache.org/community/contribute.html#nightly-builds
如果我有接口
public interface TestService {
public String getSomething();
}
和一个class
import org.apache.ignite.services.Service;
import org.apache.ignite.services.ServiceContext;
public class TestServiceImpl implements Service, TestService {
@Override
public void init(ServiceContext ctx) throws Exception {
}
@Override
public void execute(ServiceContext ctx) throws Exception {
}
@Override
public void cancel(ServiceContext ctx) {
}
@Override
public String getSomething() {
return "HelloWorld";
}
}
我使用
在 ignite 服务器节点上部署此服务// Deploy services only on server nodes.
IgniteServices serverSvcs = ignite.services(ignite.cluster().forServers());
// Deploy cluster singleton.
serverSvcs.deployClusterSingleton("TestService", new TestServiceImpl());
并且 Ignite 客户端节点尝试获取服务
TestService testSvc = mIgnite.services().serviceProxy("TestService", TestService.class, false);
如果客户端节点不包含 "TestServiceImpl" class,
将捕获异常消息: "Failed to find class with given class loader for unmarshalling (make sure same versions of all classes are available on all nodes or enable peer-class-loading)",
ignite 客户端节点是否必须具有 class TestServiceImpl?
这已经修复,修复将在即将发布的 Ignite 1.6 中发布。同时,您可以下载每晚构建版本并检查它是否适合您:http://ignite.apache.org/community/contribute.html#nightly-builds