Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Pointcut around constructor

Hello,
I learn aspectJ, being at the beginning.

I have 2 classes. I want to send second class to another computer and
take its object remotely.

//class which will be used locally
public class CalcExecutor
{
	public static void main(String[] args)
	{
		long num1 = Integer.parseInt(args[0]);
		long num2 = Integer.parseInt(args[1]);
		Calc c = new Calc();
		System.out.println( "We add: "+num1 +" and: "+ num2 +"and obtain:
"+c.add(num1, num2) );
	}
}

//class which I want to send and use its object remotely
public class Calc
{
	public Calc() {}
	
	public long add(long a, long b)
	{
		return a + b;
	}
}

I would like to shadow with around() advice:
THIS
   Calc c = new Calc();
WITH THIS
   Calc c = (Calc)Naming.lookup("rmi://localhost:1099/CalculatorService");

I have problem with around() because it must return something. But why?
Could You help me. Thanks a lot.
Pawel


Back to the top