Interface
package ru.service.grid;
import org.apache.ignite.services.Service;
public interface HashService extends Service {
String getHash(String str);
}
Implementation
package ru.service.grid;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.ignite.services.Service;
import org.apache.ignite.services.ServiceContext;
import java.io.Serializable;
public class HashServiceImpl implements HashService {
private static final long serialVersionUID = 3L;
@Override
public void cancel(ServiceContext ctx) {
System.out.println("Service was cancelled: " + ctx.name());
}
@Override
public void init(ServiceContext ctx) throws Exception {
System.out.println("Service was initialized: " + ctx.name());
}
@Override
public void execute(ServiceContext ctx) throws Exception {
System.out.println("Service was executed: " + ctx.name());
}
@Override
public String getHash(String str) {
String hash = DigestUtils.md5Hex(str);
System.out.println("Server: " + hash);
return hash;
}
}
Config
<property name="peerClassLoadingEnabled" value="true"/>
<property name="serviceConfiguration">
<list>
<bean
class="org.apache.ignite.services.ServiceConfiguration">
<property name="service">
<bean class="ru.service.grid.HashServiceImpl"/>
</property>
<property name="totalCount" value="2"/>
<property name="maxPerNodeCount" value="1"/>
</bean>
</list>
</property>
Run
Ignition.start("service.xml")
Error
java.lang.ClassNotFoundException: ru.service.grid.HashServiceImpl
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/