Re: Ignite Services: How to preserve value of Local variables ?

2016-08-05 Thread vkulichenko
Kamal,

So is it working for you now?

Changing the initialization process in service is not an option right now,
probably in 2.0.

-Val



--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/Ignite-Services-How-to-preserve-value-of-Local-variables-tp4094p6811.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.


Re: Ignite Services: How to preserve value of Local variables ?

2016-08-04 Thread Kamal C
Val,

To reproduce the exception, I've made a simple example. Actually, I'm
creating state objects
in the Service#init block.

I've updated my approach. It doesn't makes sense to make initialization as
asynchronous.

Regards,
Kamal C

On Thu, Aug 4, 2016 at 6:21 AM, vkulichenko <valentin.kuliche...@gmail.com>
wrote:

> Kamal,
>
> Did you have a chance to look at compute grid as an alternative?
>
> -Val
>
>
>
> --
> View this message in context:
> http://apache-ignite-users.70518.x6.nabble.com/Ignite-Services-How-to-preserve-value-of-Local-variables-tp4094p6724.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>


Re: Ignite Services: How to preserve value of Local variables ?

2016-08-03 Thread vkulichenko
Kamal,

Did you have a chance to look at compute grid as an alternative?

-Val



--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/Ignite-Services-How-to-preserve-value-of-Local-variables-tp4094p6724.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.


Re: Ignite Services: How to preserve value of Local variables ?

2016-08-03 Thread Kamal C
Val.

In real use-case, all the initialization are done in the *init* block. Due
to the above
mentioned behavior, I want to deploy the services locally / manually after
initialization.

The suggested approach to deploy a service only in the local node is not
working.
Do you have any alternate solution ?

On Wed, Aug 3, 2016 at 3:48 AM, vkulichenko <valentin.kuliche...@gmail.com>
wrote:

> Hi Kamal,
>
> This issue is related to this one:
> https://issues.apache.org/jira/browse/IGNITE-3392. Current service
> deployment process is asynchronous, so if it takes a lot of time to deploy
> it, you can get these exceptions in the logs. Note that they actually do
> not
> break anything, everything becomes stable after the service is executed on
> the second node.
>
> Consider using Compute Grid [1] instead. It can a better option if you use
> only node singletons and if they don't have any specific lifecycle. I.e.,
> if
> they are used to execute a piece of code on a server node.
>
> [1] https://apacheignite.readme.io/docs/compute-grid
>
> -Val
>
>
>
> --
> View this message in context:
> http://apache-ignite-users.70518.x6.nabble.com/Ignite-Services-How-to-preserve-value-of-Local-variables-tp4094p6686.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>


Re: Ignite Services: How to preserve value of Local variables ?

2016-08-02 Thread vkulichenko
Hi Kamal,

This issue is related to this one:
https://issues.apache.org/jira/browse/IGNITE-3392. Current service
deployment process is asynchronous, so if it takes a lot of time to deploy
it, you can get these exceptions in the logs. Note that they actually do not
break anything, everything becomes stable after the service is executed on
the second node.

Consider using Compute Grid [1] instead. It can a better option if you use
only node singletons and if they don't have any specific lifecycle. I.e., if
they are used to execute a piece of code on a server node.

[1] https://apacheignite.readme.io/docs/compute-grid

-Val



--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/Ignite-Services-How-to-preserve-value-of-Local-variables-tp4094p6686.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.


Re: Ignite Services: How to preserve value of Local variables ?

2016-07-29 Thread vkulichenko
Hi Kamal,

A. You can provide the cluster group with local node only:

ignite.services(ignite.cluster().forLocal()).deploy(...);

B. If you start the service with the same name, this should not happen. I
tried to reproduce your behavior, but everything works as expected for me.
Do you a have a test that you can share?

-Val



--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/Ignite-Services-How-to-preserve-value-of-Local-variables-tp4094p6637.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.


Re: Ignite Services: How to preserve value of Local variables ?

2016-04-12 Thread Kamal C
Yes. I took a similar approach except I had state variables in my services.
I'll update it.

In RMI mode, clients don't need to have the implementation classes as it
works on the stub. In Ignite, client node expects the implementation
classes to present on the class path.
On 13-Apr-2016 7:52 AM, "vkulichenko" <valentin.kuliche...@gmail.com> wrote:

> Kamal,
>
> You can deploy node singleton (i.e., the service that will run on each
> node)
> and use IgniteServices.serviceProxy() to do remote calls from a client.
> Will
> this work for you?
>
> -Val
>
>
>
> --
> View this message in context:
> http://apache-ignite-users.70518.x6.nabble.com/Ignite-Services-How-to-preserve-value-of-Local-variables-tp4094p4107.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>


Ignite Services: How to preserve value of Local variables ?

2016-04-12 Thread Kamal C
Hi all,

While I'm using the Ignite Service Grid, I found a weird behavior in
which values of local variables are getting overridden.

I have two ignite nodes and I deployed the service in node singleton
approach. When the second node comes up and joins the cluster, it's local
variable values are getting overridden by the values in the first node.



*Sample Code*







































*import org.apache.ignite.Ignite;import org.apache.ignite.Ignition;import
org.apache.ignite.services.Service;import
org.apache.ignite.services.ServiceContext;public class DummyService
implements Service {private static final long serialVersionUID = 1L;
private final String server_id = System.getProperty("SERVER_ID", "1");
// Local variable value differ from one node to anotherpublic
DummyService() {System.out.printf("S : %s, Dummy Service
instantiated%n", server_id);}@Overridepublic void
cancel(ServiceContext context) {System.out.printf("S : %s,
Distributed Service : %s cancelled%n", server_id, context.name
()); // server_id value overridden}
@Overridepublic void execute(ServiceContext context) throws Exception
{System.out.printf("S : %s, Distributed Service : %s executed%n",
server_id, context.name ()); // server_id value
overridden}@Overridepublic void init(ServiceContext context)
throws Exception {System.out.printf("S : %s, Distributed Service :
%s inited%n", server_id, context.name ()); //
server_id value overridden}public static void main(String[] args)
{String server_id = "200"; // Replace the server_id with
300 while starting the second nodeSystem.setProperty("SERVER_ID",
server_id);Ignite ignite =
Ignition.start("examples/config/example-ignite.xml");DummyService
service = new DummyService();
ignite.services().deployNodeSingleton("DummyService", service);
System.out.printf("S : %s, Dummy service deployed successfully%n",
server_id);}}*

In the above code, *server_id *values gets overridden while starting second
node. I've tried it by enabling and disabling peer-to-peer class loading.
But, the behavior is still same.

How to preserve the value of local variables?

--Kamal