Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question

Revision history [back]

Using Task Resource Injection

Hi,

I've successfully implemented and tested a normal Executor using the DistributedTask interface.

Everything works fine, but now I need to implement also Task Resource Injection ([http://www.gigaspaces.com/wiki/display/XAP66/Executors+Component#ExecutorsComponent-TaskResourceInjection]) and this doesn't seem to work.

My PU is like this:

class MyPU { private Properties prop; MyPU() {prop = new Properties();} ... }

And My Task is:

@AutowireTask class MyTask implements DistributedTask<integer, long=""> {

@Resource(name="prop")
private transient Properties prop;

public Integer execute() throws Exception {
    System.out.println("Before");
    System.out.println(prop.size());
    System.out.println("After");
    return 1;
}

...

}

The Task, when executed, correctly prints "Before" in the server but then, in the client, throws a NullPointerException because prop is null.

Did I miss something?

Thanks in advance ;)

Using Task Resource Injection

Hi,

I've successfully implemented and tested a normal Executor using the DistributedTask interface.

Everything works fine, but now I need to implement also Task Resource Injection ([http://www.gigaspaces.com/wiki/display/XAP66/Executors+Component#ExecutorsComponent-TaskResourceInjection]) and this doesn't seem to work.

My PU is like this:

class MyPU { private Properties prop; MyPU() {prop = new Properties();} ... }

And My Task is:

@AutowireTask class MyTask implements DistributedTask<integer, long=""> {

@Resource(name="prop")
private transient Properties prop;

public Integer execute() throws Exception {
    System.out.println("Before");
    System.out.println(prop.size());
    System.out.println("After");
    return 1;
}

...

}

The Task, when executed, correctly prints "Before" in the server but then, in the client, throws a NullPointerException because prop is null.

Did I miss something?

Thanks in advance ;)