ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pgarg <pg...@gridgain.com>
Subject Re: Undeploy Service
Date Sat, 09 May 2015 18:06:44 GMT
/commented by daniel m√ľnstermann/

This is my simplest implementation. I expect the service to stop working by
calling the cancel-method (from another class via
ignite.services().cancel("ServiceTest"); ) and so the object won't be used
any more. The method stops working correctly but the service is still
deployed... So, how to undeploy it after it has stopped working? I'm sure to
miss something obvious here...

/public class ServiceTest extends Service {
    private boolean cancelled;
    private ServiceConfiguration serviceConfig;
    @IgniteInstanceResource private Ignite ignite;

    public ServiceTest() {
            serviceConfig = new ServiceConfiguration();
            serviceConfig.setName("ServiceTest");
            serviceConfig.setMaxPerNodeCount(maxInstNode);
            serviceConfig.setTotalCount(maxInstCluster);
            serviceConfig.setService(this);
            ignite.services().deploy(serviceConfig);
    }

    @Override
    public void cancel(ServiceContext ctx) {
            cancelled = true;
     }
    
    @Override
    public void init(ServiceContext ctx) throws Exception {
    cancelled = false;
    }

    @Override
    public void execute(ServiceContext ctx) {
    while (!cancelled) {
        System.out.println("test");
    }
    try {
        Thread.sleep(20);
    catch (InterruptedException e{
       //do nothing
    }
   
[...] }/

----- 
/This post is migrated from now discontinued Apache Ignite forum at 
http://apacheignite.readme.io/v1.0/discuss/



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Undeploy-Service-tp210p214.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Mime
View raw message