Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = tab
insert_final_newline = true
trim_trailing_whitespace = true
11 changes: 6 additions & 5 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,20 @@ jobs:
os:
- ubuntu-latest
java:
- 17
- 21
- 25
name: Java ${{ matrix.java }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Java ${{ matrix.java }}
- name: Setup Java
uses: actions/setup-java@v5
with:
java-version: ${{ matrix.java }}
java-version: |
17
21
25
distribution: 'temurin'
cache: maven
- name: Verify
run: mvn --batch-mode verify
run: mvn --batch-mode --no-transfer-progress verify -P lts
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public ClassLoader getClassLoader() {
Contextualizer contextualizer = Contextualizer.withContextProvider(ThreadContextClassLoaderReference.CURRENT.provide(context.getLoader().getClassLoader()));
ContainerProvider<ServletContext, HttpSession, HttpSessionActivationListener, CatalinaSessionContext> provider = new ServletContainerProvider<>();
AtomicReference<SessionManager<CatalinaSessionContext>> sessionManagerReference = new AtomicReference<>();
Consumer<ImmutableSession> destroyNotifier = session -> CatalinaSessionEventNotifier.Lifecycle.DESTROY.accept(this, new HttpSessionEvent(provider.getDetachableSession(sessionManagerReference.getPlain(), session, this.getContext().getServletContext())));
Consumer<ImmutableSession> destroyNotifier = session -> CatalinaSessionEventNotifier.Lifecycle.DESTROY.accept(this, new HttpSessionEvent(provider.getSession(sessionManagerReference.getPlain(), session, this.getContext().getServletContext())));
Supplier<String> identifierFactory = new CatalinaIdentifierFactory(this.getSessionIdGenerator());

SessionManagerConfiguration<ServletContext> sessionManagerConfiguration = new SessionManagerConfiguration<>() {
Expand All @@ -240,7 +240,7 @@ public Supplier<String> getIdentifierFactory() {

@Override
public Consumer<ImmutableSession> getExpirationListener() {
return Consumer.<ImmutableSession>empty().andThen(contextualizer.contextualize(destroyNotifier));
return Consumer.<ImmutableSession>of().andThen(contextualizer.contextualize(destroyNotifier));
}
};
sessionManagerReference.setPlain(managerFactory.createSessionManager(sessionManagerConfiguration));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private org.apache.catalina.Session getSession(BiFunction<SessionManager<Catalin
return close(context, closeTask);
}
if (session.getMetaData().getLastAccessTime().isEmpty()) {
HttpSessionEvent event = new HttpSessionEvent(this.getContainerProvider().getDetachableSession(this.getSessionManager(), session, this.getContext().getServletContext()));
HttpSessionEvent event = new HttpSessionEvent(this.getContainerProvider().getSession(this.getSessionManager(), session, this.getContext().getServletContext()));
CatalinaSessionEventNotifier.Lifecycle.CREATE.accept(this, event);
}
return new DistributableSession(this, session, suspendedBatch, closeTask);
Expand Down Expand Up @@ -190,7 +190,7 @@ private Map.Entry<SuspendedBatch, Runnable> createBatchEntry() {
}

private static org.apache.catalina.Session close(Supplier<Batch> batchProvider, Runnable closeTask) {
return close(batchProvider, Consumer.empty(), closeTask);
return close(batchProvider, Consumer.of(), closeTask);
}

private static org.apache.catalina.Session close(Supplier<Batch> batchProvider, Consumer<Batch> batchTask, Runnable closeTask) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public void setMaxInactiveInterval(int interval) {
@Override
public void invalidate() {
Session<CatalinaSessionContext> session = this.reference.get();
HttpSessionEvent event = new HttpSessionEvent(this.manager.getContainerProvider().getDetachableSession(this.manager.getSessionManager(), session, this.manager.getContext().getServletContext()));
HttpSessionEvent event = new HttpSessionEvent(this.manager.getContainerProvider().getSession(this.manager.getSessionManager(), session, this.manager.getContext().getServletContext()));
CatalinaSessionEventNotifier.Lifecycle.DESTROY.accept(this.manager, event);
this.close(session, Session::invalidate);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
public class SessionCookieValve extends ValveBase {
private static final VarHandle SESSION = findSessionField();

/** Creates a new valve */
public SessionCookieValve() {
}

private static VarHandle findSessionField() {
try {
return MethodHandles.privateLookupIn(Request.class, MethodHandles.lookup()).findVarHandle(Request.class, "session", Session.class);
Expand All @@ -33,10 +37,6 @@ private static VarHandle findSessionField() {
}
}

/** Creates a new valve */
public SessionCookieValve() {
}

@Override
public void invoke(Request request, Response response) throws IOException, ServletException {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ protected void removeSession(String ssoId, Session session) {
try (User<Credentials, TransientUserContext, String, String> sso = this.manager.findUser(ssoId)) {
if (sso != null) {
sso.getSessions().removeSession(getDeployment(session.getManager()));
if (sso.getSessions().getDeployments().isEmpty()) {
if (sso.getSessions().getSessions().isEmpty()) {
sso.invalidate();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ public void setAddress(String address) {
}

@Override
public void renameThread(String base_name, Thread thread) {
this.factory.renameThread(base_name, thread);
public void renameThread(String baseName, Thread thread) {
this.factory.renameThread(baseName, thread);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public class InfinispanManager extends AbstractManager {
private static final AtomicInteger COUNTER = new AtomicInteger(0);

private volatile String resourceName = "infinispan.xml";
private volatile String cacheName = null;
private volatile String cacheName;

/**
* Creates a distributed manager.
Expand Down
6 changes: 3 additions & 3 deletions 10.1/infinispan/embedded/src/test/resources/tomcat/server.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>

<GlobalNamingResources>
<Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml" />
<Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml"/>
</GlobalNamingResources>

<Service name="Catalina">
Expand All @@ -21,8 +21,8 @@
</Realm>

<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b" />
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b"/>
</Host>
</Engine>
</Service>
</Server>
</Server>
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ public class HotRodManager extends AbstractManager {

private final Properties properties = new Properties();

private volatile String templateName = null;
private String configuration = """
private volatile String templateName;
private volatile String configuration =
"""
{
"distributed-cache" : {
"mode" : "SYNC",
Expand All @@ -64,8 +65,9 @@ public class HotRodManager extends AbstractManager {
"locking" : "PESSIMISTIC"
}
}
}""";
private volatile URI uri = null;
}
""";
private volatile URI uri;

/**
* Creates a new distributed manager.
Expand Down
6 changes: 3 additions & 3 deletions 10.1/infinispan/remote/src/test/resources/tomcat/server.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>

<GlobalNamingResources>
<Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml" />
<Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml"/>
</GlobalNamingResources>

<Service name="Catalina">
Expand All @@ -21,8 +21,8 @@
</Realm>

<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b" />
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b"/>
</Host>
</Engine>
</Service>
</Server>
</Server>
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public ClassLoader getClassLoader() {
Contextualizer contextualizer = Contextualizer.withContextProvider(ThreadContextClassLoaderReference.CURRENT.provide(context.getLoader().getClassLoader()));
ContainerProvider<ServletContext, HttpSession, HttpSessionActivationListener, CatalinaSessionContext> provider = new ServletContainerProvider<>();
AtomicReference<SessionManager<CatalinaSessionContext>> sessionManagerReference = new AtomicReference<>();
Consumer<ImmutableSession> destroyNotifier = session -> CatalinaSessionEventNotifier.Lifecycle.DESTROY.accept(this, new HttpSessionEvent(provider.getDetachableSession(sessionManagerReference.getPlain(), session, this.getContext().getServletContext())));
Consumer<ImmutableSession> destroyNotifier = session -> CatalinaSessionEventNotifier.Lifecycle.DESTROY.accept(this, new HttpSessionEvent(provider.getSession(sessionManagerReference.getPlain(), session, this.getContext().getServletContext())));
Supplier<String> identifierFactory = new CatalinaIdentifierFactory(this.getSessionIdGenerator());

SessionManagerConfiguration<ServletContext> sessionManagerConfiguration = new SessionManagerConfiguration<>() {
Expand All @@ -240,7 +240,7 @@ public Supplier<String> getIdentifierFactory() {

@Override
public Consumer<ImmutableSession> getExpirationListener() {
return Consumer.<ImmutableSession>empty().andThen(contextualizer.contextualize(destroyNotifier));
return Consumer.<ImmutableSession>of().andThen(contextualizer.contextualize(destroyNotifier));
}
};
sessionManagerReference.setPlain(managerFactory.createSessionManager(sessionManagerConfiguration));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private org.apache.catalina.Session getSession(BiFunction<SessionManager<Catalin
return close(context, closeTask);
}
if (session.getMetaData().getLastAccessTime().isEmpty()) {
HttpSessionEvent event = new HttpSessionEvent(this.getContainerProvider().getDetachableSession(this.getSessionManager(), session, this.getContext().getServletContext()));
HttpSessionEvent event = new HttpSessionEvent(this.getContainerProvider().getSession(this.getSessionManager(), session, this.getContext().getServletContext()));
CatalinaSessionEventNotifier.Lifecycle.CREATE.accept(this, event);
}
return new DistributableSession(this, session, suspendedBatch, closeTask);
Expand Down Expand Up @@ -175,7 +175,7 @@ private Map.Entry<SuspendedBatch, Runnable> createBatchEntry() {
}

private static org.apache.catalina.Session close(Supplier<Batch> batchProvider, Runnable closeTask) {
return close(batchProvider, Consumer.empty(), closeTask);
return close(batchProvider, Consumer.of(), closeTask);
}

private static org.apache.catalina.Session close(Supplier<Batch> batchProvider, Consumer<Batch> batchTask, Runnable closeTask) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void access(java.util.function.Consumer<HttpSession> consumer) {
try (Session<CatalinaSessionContext> session = this.manager.getSessionManager().findSession(this.identifier.get())) {
if (session != null) {
try (Context<SuspendedBatch> context = batch.suspendWithContext()) {
consumer.accept(new HttpSessionAdapter(this.manager, Supplier.of(session), context.get(), Runner.empty()));
consumer.accept(new HttpSessionAdapter(this.manager, Supplier.of(session), context.get(), Runner.of()));
}
}
} catch (RuntimeException | Error e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public void setMaxInactiveInterval(int interval) {
@Override
public void invalidate() {
Session<CatalinaSessionContext> session = this.reference.get();
HttpSessionEvent event = new HttpSessionEvent(this.manager.getContainerProvider().getDetachableSession(this.manager.getSessionManager(), session, this.manager.getContext().getServletContext()));
HttpSessionEvent event = new HttpSessionEvent(this.manager.getContainerProvider().getSession(this.manager.getSessionManager(), session, this.manager.getContext().getServletContext()));
CatalinaSessionEventNotifier.Lifecycle.DESTROY.accept(this.manager, event);
this.close(session, Session::invalidate);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
public class SessionCookieValve extends ValveBase {
private static final VarHandle SESSION = findSessionField();

/** Creates a new valve */
public SessionCookieValve() {
}

private static VarHandle findSessionField() {
try {
return MethodHandles.privateLookupIn(Request.class, MethodHandles.lookup()).findVarHandle(Request.class, "session", Session.class);
Expand All @@ -33,10 +37,6 @@ private static VarHandle findSessionField() {
}
}

/** Creates a new valve */
public SessionCookieValve() {
}

@Override
public void invoke(Request request, Response response) throws IOException, ServletException {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ protected void removeSession(String ssoId, Session session) {
try (User<Credentials, TransientUserContext, String, String> sso = this.manager.findUser(ssoId)) {
if (sso != null) {
sso.getSessions().removeSession(getDeployment(session.getManager()));
if (sso.getSessions().getDeployments().isEmpty()) {
if (sso.getSessions().getSessions().isEmpty()) {
sso.invalidate();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ public void setAddress(String address) {
}

@Override
public void renameThread(String base_name, Thread thread) {
this.factory.renameThread(base_name, thread);
public void renameThread(String baseName, Thread thread) {
this.factory.renameThread(baseName, thread);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public class InfinispanManager extends AbstractManager {
private static final AtomicInteger COUNTER = new AtomicInteger(0);

private volatile String resourceName = "infinispan.xml";
private volatile String cacheName = null;
private volatile String cacheName;

/**
* Creates a distributed manager.
Expand Down
6 changes: 3 additions & 3 deletions 11.0/infinispan/embedded/src/test/resources/tomcat/server.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>

<GlobalNamingResources>
<Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml" />
<Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml"/>
</GlobalNamingResources>

<Service name="Catalina">
Expand All @@ -21,8 +21,8 @@
</Realm>

<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b" />
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b"/>
</Host>
</Engine>
</Service>
</Server>
</Server>
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ public class HotRodManager extends AbstractManager {

private final Properties properties = new Properties();

private volatile String templateName = null;
private String configuration = """
private volatile String templateName;

private volatile String configuration =
"""
{
"distributed-cache" : {
"mode" : "SYNC",
Expand All @@ -64,8 +66,9 @@ public class HotRodManager extends AbstractManager {
"locking" : "PESSIMISTIC"
}
}
}""";
private volatile URI uri = null;
}
""";
private volatile URI uri;

/**
* Creates a new distributed manager.
Expand Down
6 changes: 3 additions & 3 deletions 11.0/infinispan/remote/src/test/resources/tomcat/server.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>

<GlobalNamingResources>
<Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml" />
<Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml"/>
</GlobalNamingResources>

<Service name="Catalina">
Expand All @@ -21,8 +21,8 @@
</Realm>

<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b" />
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b"/>
</Host>
</Engine>
</Service>
</Server>
</Server>
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public ClassLoader getClassLoader() {
Contextualizer contextualizer = Contextualizer.withContextProvider(ThreadContextClassLoaderReference.CURRENT.provide(context.getLoader().getClassLoader()));
ContainerProvider<ServletContext, HttpSession, HttpSessionActivationListener, CatalinaSessionContext> provider = new ServletContainerProvider<>();
AtomicReference<SessionManager<CatalinaSessionContext>> sessionManagerReference = new AtomicReference<>();
Consumer<ImmutableSession> destroyNotifier = session -> CatalinaSessionEventNotifier.Lifecycle.DESTROY.accept(this, new HttpSessionEvent(provider.getDetachableSession(sessionManagerReference.getPlain(), session, this.getContext().getServletContext())));
Consumer<ImmutableSession> destroyNotifier = session -> CatalinaSessionEventNotifier.Lifecycle.DESTROY.accept(this, new HttpSessionEvent(provider.getSession(sessionManagerReference.getPlain(), session, this.getContext().getServletContext())));
Supplier<String> identifierFactory = new CatalinaIdentifierFactory(this.getSessionIdGenerator());

SessionManagerConfiguration<ServletContext> sessionManagerConfiguration = new SessionManagerConfiguration<>() {
Expand All @@ -240,7 +240,7 @@ public Supplier<String> getIdentifierFactory() {

@Override
public Consumer<ImmutableSession> getExpirationListener() {
return Consumer.<ImmutableSession>empty().andThen(contextualizer.contextualize(destroyNotifier));
return Consumer.<ImmutableSession>of().andThen(contextualizer.contextualize(destroyNotifier));
}
};
sessionManagerReference.setPlain(managerFactory.createSessionManager(sessionManagerConfiguration));
Expand Down
Loading
Loading