0

I'm using Widlfy 10, but do not want to use the DistributableSessions that are used by Wildfly out of the box (I am having some session handling issues and need to debug things at a basic level). I see that Undertow has an InMemorySessionManager which I would rather use instead. But I haven't been able to figure out how to specify a different SessionManager.

I've tried to configure my Wildfly cache as a local cache:

        <subsystem xmlns="urn:jboss:domain:infinispan:4.0">
            <cache-container name="server" aliases="singleton cluster" default-cache="default" module="org.wildfly.clustering.server">
                <transport lock-timeout="60000"/>
                <replicated-cache name="default" mode="SYNC">
                    <transaction mode="BATCH"/>
                </replicated-cache>
            </cache-container>
            <cache-container name="web" default-cache="passivation" module="org.wildfly.clustering.web.infinispan">
                <local-cache name="passivation">
                    <locking isolation="REPEATABLE_READ"/>
                    <transaction mode="BATCH"/>
                    <file-store passivation="true" purge="false"/>
                </local-cache>
                <local-cache name="persistent">
                    <locking isolation="REPEATABLE_READ"/>
                    <transaction mode="BATCH"/>
                    <file-store passivation="false" purge="false"/>
                </local-cache>
            </cache-container>
...
...

However, in debugging my application, I still see that Wildfly is using the DistributableSessionManager and DistributableSessions instead.

Is there anyway to enable the Undertwo's InMemorySessionManager instead? Do I have to go through the effort of creating my own ServletExtension and Factory and configuring it in the META-INF/services/io.undertow.servlet.ServletExtension or is there an out-of-the-box way of enable functionality that already exists via the config file? Or do the required classes already exist as part of the Undertow/Wildfly packaging?

Eric B.
  • 23,425
  • 50
  • 169
  • 316

1 Answers1

2

There are only conditions that result in the use of the distributed session manager:

  1. in web.xml
  2. Using shared sessions across web application within an ear, via shared-session-config.xml

Given that you've already stated that #1 is not the case, I'll assume #2. To disable the use of the distributed session manager for shared sessions, remove the org.wildfly.clustering.web.undertow module from your distribution.

Paul Ferraro
  • 326
  • 1
  • 3
  • Indeed, I am using the shared-session to have session sharing in 2 wars in my ear. I didn't realize that would force/imply the DistributedSessions. At the root of my issue, is that I am I trying to use the Undertow SessionManager to retrieve a session by id and invalidate it, but I am unable to do that with the DistributedSessions (the SessionManager returns an ImmutableDistributedSession). Is there anyway to invalidate a distributed session via the Session Manager or the Undertow session it returns? – Eric B. Dec 21 '17 at 23:32
  • Why invalidate the session via the SessionManager? Can you not just call HttpSession.invalidate()? – Paul Ferraro Jan 04 '18 at 20:29
  • I've been working on a legacy JBoss3/JB4 application and the way this was originally designed was to use background processes to invalidate sessions based on a bunch of business rules. Moving it to WF10 with undertow doesn't allow for the same session management. So I've since ripped out all those background processes and moved the session invalidation to a filter based on some business logic helper classes instead. So the question becomes moot at this point. – Eric B. Jan 05 '18 at 19:37