[jboss-user] [JBoss AOP] - Re: Linking Aspect makes interception not working for a shor

waffels do-not-reply at jboss.com
Fri Apr 13 04:07:45 EDT 2007


ok, 

i have just the AspectManager to link and unlink the aspects:

these are the methods i use to create and link the aspects

public static void create(String aspect_id, String className){
		System.out.println("create aspect-id="+aspect_id+" classname="+className);
		AspectFactory af = new GenericAspectFactory(className, null);
		AspectDefinition ad = new AspectDefinition(aspect_id, Scope.PER_VM, af);
		AspectManager.instance().addAspectDefinition(ad);
	}


	public static void link(String aspect_id, String methodname,String binding,String binding_id){
		System.out.println("link aspect_id="+aspect_id+" method="+methodname+" binding="+binding+" binding_id="+binding_id);
		AdviceBinding adviceBinding=null;
		try {
			adviceBinding = new AdviceBinding(binding,null);
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} 
		
		AspectDefinition ad = AspectManager.instance().getAspectDefinition(aspect_id);
		adviceBinding.addInterceptorFactory(new AdviceFactory(ad, methodname));
		adviceBinding.setName(binding_id);
		AspectManager.instance().addBinding(adviceBinding);
		
		
		
	}
	

So all the bindings have their personal ID,

to unlick them i use


	public static void unLink(String binding_id){
		System.out.println("unlinking "+binding_id);
				AspectManager.instance().removeBinding(binding_id);
		
		
	}
	

as for the application itself:

There's a client which is connected to a server using Jboss RMI with transport using an interface,

The client is also connected to a third pc which gives the orders to the client to link/unlink aspect in a seperate thread

the main client thread jusdt looks something like this:

		for (int i = 0 ; i < 40000; i++) {
			try {
				System.out.println(stub.receiveMessage(new Integer(i).toString()));
			} catch (RemoteException e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
			try {
				Thread.sleep(10);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
		}

it just sends out numbers to the server...

the server just prints those numbers out

now iun the regular case the numbers get compressed at clientside before they are send to the server, and at the serverside they are decompressed before printed out, so that just gives something like:

client:
"compressing message 1"
"sending message 1"
	
server:
"decompressing message..."
received message: 1

then client:
message 1 received at server


then message2 and so on...

but now: when i send at frequentie of 10 ms and i link an arbitrary aspect at an arbitrary place at the clientside (in another thread than the sending thread)
it causes some messages at the clientside NOT to compress, so while linking the arbitrary aspect, there occur no interceptions at the clientside...

serverside then tries to decompress them which obviously doesn't work...

hope this help you understand it better



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4036970#4036970

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4036970



More information about the jboss-user mailing list