Şöyle yaparız
FROM payara/server-full:6.2022.1COPY ./target/${artifactId}.war $DEPLOY_DIR
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
@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";}
//Like the EJB Timer annotation but for other components e.g. CDI Beans (non-persistent)@ApplicationScopedpublic class ScheduledBean {@Schedule(executor="MyExecutor", minute="*/5")public void fiveMinuteRule() {}}
//Provides locking semantics for CDI Beans – especially useful for ApplicationScoped//Semantics would be similar to EJB Locks@ApplicationScopedpublic class CDIBean {@Lock(LockType.READ)public void doReadMany(){}@Lock(LockType.WRITE)public void doOneWriter() {}}
//Limits through Semaphore the number of threads that can execute a method or all//methods concurrently.@ApplicationScopedpublic class CDIBean {@MaxConcurrency(2)public void maxTwoThreadsMethod(){};@MaxConcurrency(10)public void maxUseofAPI(){}}
<dependency><groupId>jakarta.enterprise.concurrent</groupId><artifactId>jakarta.enterprise.concurrent-api</artifactId><version>1.1.2</version></dependency>
<dependency><groupId>jakarta.enterprise.concurrent</groupId><artifactId>jakarta.enterprise.concurrent-api</artifactId><version>2.0</version></dependency>
<dependency><groupId>jakarta.enterprise.concurrent</groupId><artifactId>jakarta.enterprise.concurrent-api</artifactId><version>3.0.2</version></dependency>
Java Cache ProvidersThe JVM ecosystem has an official Cache API, known as JCache, or JSR 107. It’s a specification with an API that describes four annotations, i.e., @CacheResult, @CachePut, @CacheRemove, and @CacheRemoveAll. Vendors are to implement the specification.The Spring framework is pretty widespread in the JVM ecosystem. It also provides a caching API. Historically, it predates JCache. While different, the API is very similar to JCache’s. Spring offers out-of-the-box integration code for a couple of caches, while a couple of others do provide Spring integration.
import javax.cache.CacheManager;
It enables us to establish, configure and close Caches.
import com.hazelcast.cache.HazelcastCacheManager;
public class ServiceImpl { @Override @CacheResult(cacheName = ..., cacheKeyGenerator = DefaultObjectsCacheKeyGenerator.class) public Foo getObject(@CacheKey String userId, @CacheKey String customerId) { ... } }
Örnek Elimizde şöyle bir kod olsun public class SampleRequest { @NotNull LocalDate startDate; @NotNull LocalDate endDate; @AssertT...