-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34525 from manovotn/issue34332
Undertow - fire context events for session context
- Loading branch information
Showing
3 changed files
with
75 additions
and
1 deletion.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
...ertow/deployment/src/test/java/io/quarkus/undertow/test/sessioncontext/ObservingBean.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package io.quarkus.undertow.test.sessioncontext; | ||
|
||
import jakarta.enterprise.context.ApplicationScoped; | ||
import jakarta.enterprise.context.BeforeDestroyed; | ||
import jakarta.enterprise.context.Destroyed; | ||
import jakarta.enterprise.context.Initialized; | ||
import jakarta.enterprise.context.SessionScoped; | ||
import jakarta.enterprise.event.Observes; | ||
|
||
@ApplicationScoped | ||
public class ObservingBean { | ||
|
||
int timesInitObserved = 0; | ||
int timesBeforeDestroyedObserved = 0; | ||
int timesDestroyedObserved = 0; | ||
|
||
public int getTimesInitObserved() { | ||
return timesInitObserved; | ||
} | ||
|
||
public int getTimesBeforeDestroyedObserved() { | ||
return timesBeforeDestroyedObserved; | ||
} | ||
|
||
public int getTimesDestroyedObserved() { | ||
return timesDestroyedObserved; | ||
} | ||
|
||
public void observeInit(@Observes @Initialized(SessionScoped.class) Object event) { | ||
timesInitObserved++; | ||
} | ||
|
||
public void observeBeforeDestroyed(@Observes @BeforeDestroyed(SessionScoped.class) Object event) { | ||
timesBeforeDestroyedObserved++; | ||
} | ||
|
||
public void observeDestroyed(@Observes @Destroyed(SessionScoped.class) Object event) { | ||
timesDestroyedObserved++; | ||
} | ||
|
||
public void resetState() { | ||
this.timesInitObserved = 0; | ||
this.timesBeforeDestroyedObserved = 0; | ||
this.timesDestroyedObserved = 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters