Açıklaması şöyle
Used when you need an object to run on a non managed thread using a Jakarta EE Context.Key for maintaining Security Context that can be propagated to other threadsOne example is a JMX Notification Listener
Örnek
Şöyle yaparız
@ResourceContextService contextSvc;@GET@Path("runnableproxy")@Produces(MediaType.TEXT_PLAIN)public String useProxy() {Runnable instance =() -> System.out.println("Running in context");Runnable proxy = contextSvc.createContextualProxy(instance,Runnable.class);Thread thread = new Thread(proxy);thread.start();return "Started new thread";}
Hiç yorum yok:
Yorum Gönder