aspect X {
  before(): call(Thread.new(..)) { // Thread constructor called
    System.out.println("Thread created!");
  }
  before(): call(* Thread.start(..)) { // Thread.start called
    System.out.println("Thread started!");
  }
}

Andy

> On Jul 20, 2016, at 1:07 AM, ants <anto.aravinth....@gmail.com> wrote:
> 
> 
> 
> On Wed, Jul 20, 2016 at 1:03 PM, Alexander Kriegisch-2 [via AspectJ] <[hidden 
> email] <x-msg://16/user/SendEmail.jtp?type=node&node=4652110&i=0>> wrote:
> You can easily hook into places where your own code creates threads. 
> 
> If you need to hook into threads created by third party libs, you need to 
> weave their binaries via post-compile or load-time weaving.
> 
> Can you give some examples for it with respect to weaving thread creation? 
>  
> 
> 
> Theoretically you can also weave into the JDK, creating your own tools.jar 
> with woven classes, but probably you do not want to go that far. I have done 
> that in the past just for the fun of it. 
> -- 
> Alexander Kriegisch 
> https://scrum-master.de <https://scrum-master.de/>
> 
> 
> > Am 20.07.2016 um 05:42 schrieb ants <[hidden email] 
> > <http://user/SendEmail.jtp?type=node&node=4652109&i=0>>: 
> > 
> > Hi All, 
> > 
> > Is there a way to hook to thread creations and destroy from AspectJ 
> > pointcuts? 
> > 
> > ` Anto. 
> > 
> > 
> > 
> > -- 
> > View this message in context: 
> > http://aspectj.2085585.n4.nabble.com/Hook-Thread-Creations-tp4652108.html 
> > <http://aspectj.2085585.n4.nabble.com/Hook-Thread-Creations-tp4652108.html>
> > Sent from the AspectJ - users mailing list archive at Nabble.com. 
> > _______________________________________________ 
> > aspectj-users mailing list
> > [hidden email] <http://user/SendEmail.jtp?type=node&node=4652109&i=1> 
> > To change your delivery options, retrieve your password, or unsubscribe 
> > from this list, visit 
> > https://dev.eclipse.org/mailman/listinfo/aspectj-users 
> > <https://dev.eclipse.org/mailman/listinfo/aspectj-users>
> _______________________________________________ 
> aspectj-users mailing list 
> [hidden email] <http://user/SendEmail.jtp?type=node&node=4652109&i=2> 
> To change your delivery options, retrieve your password, or unsubscribe from 
> this list, visit 
> https://dev.eclipse.org/mailman/listinfo/aspectj-users 
> <https://dev.eclipse.org/mailman/listinfo/aspectj-users>
> 
>  smime.p7s (3K) Download Attachment 
> <http://aspectj.2085585.n4.nabble.com/attachment/4652109/0/smime.p7s>
> 
> If you reply to this email, your message will be added to the discussion 
> below:
> http://aspectj.2085585.n4.nabble.com/Hook-Thread-Creations-tp4652108p4652109.html
>  
> <http://aspectj.2085585.n4.nabble.com/Hook-Thread-Creations-tp4652108p4652109.html>
> To unsubscribe from Hook Thread Creations, click here 
> <applewebdata://5CC0FD53-FFDC-4103-879C-A750475D90BC>.
> NAML 
> <http://aspectj.2085585.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
> 
> View this message in context: Re: Hook Thread Creations 
> <http://aspectj.2085585.n4.nabble.com/Hook-Thread-Creations-tp4652108p4652110.html>
> Sent from the AspectJ - users mailing list archive 
> <http://aspectj.2085585.n4.nabble.com/AspectJ-users-f2077686.html> at 
> Nabble.com.
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@eclipse.org
> To change your delivery options, retrieve your password, or unsubscribe from 
> this list, visit
> https://dev.eclipse.org/mailman/listinfo/aspectj-users

_______________________________________________
aspectj-users mailing list
aspectj-users@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to