Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-dev] pointcut problem

Hi Eric,

hmmm, have you tried using a call pointcut instead of execution, like the following:

after() returning(): within(Server) && call(ServerSocket.new(int)) {
    System.out.println("listening...");
}

I think this may solve the problem as you cannot be within(Server) and execution(ServerSocket..) at the same time, however you can will the call to the constructor as indicated by the call pointcut.

Let me know if this helps :)

Cheers,

Russ

On Wednesday, May 19, 2004, at 01:47PM, Eric Macaulay <eeoam@xxxxxxxxx> wrote:

I have the following constructor:
 
public Server() {
   try {
    socket = new ServerSocket(2004);
   }catch(IOException x) {
    System.out.println("Unable to create server socket.");
    System.exit(-1);
   }
  }
 
When the ServerSocket constructor returns I want to to print out a message so I used this code:
 
after() returning(): within(Server) && execution(ServerSocket.new(int)) {
    System.out.println("listening...");
}
 
Howeve when I run the program no message is displayed. Can anyone help?
 
Eric Macaulay
 


Back to the top