Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Riina Antikainen
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 68a7d8a3
authored
May 08, 2015
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only add User session container if container was not found
1 parent
71dd6834
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
code/moya-beans/ejbModule/fi/codecrew/moya/beans/SessionMgmtBean.java
code/moya-beans/ejbModule/fi/codecrew/moya/beans/SessionMgmtBean.java
View file @
68a7d8a
...
...
@@ -28,6 +28,8 @@ import javax.annotation.security.RolesAllowed;
import
javax.ejb.ConcurrencyManagement
;
import
javax.ejb.ConcurrencyManagementType
;
import
javax.ejb.LocalBean
;
import
javax.ejb.Lock
;
import
javax.ejb.LockType
;
import
javax.ejb.Singleton
;
import
javax.ejb.TransactionAttribute
;
import
javax.ejb.TransactionAttributeType
;
...
...
@@ -47,26 +49,26 @@ import fi.codecrew.moya.enums.apps.UserPermission;
@ConcurrencyManagement
(
ConcurrencyManagementType
.
BEAN
)
@TransactionAttribute
(
TransactionAttributeType
.
SUPPORTS
)
@DeclareRoles
({
UserPermission
.
S_MANAGE_HTTP_SESSION
})
@Lock
(
LockType
.
READ
)
public
class
SessionMgmtBean
implements
SessionMgmtBeanLocal
{
/**
* Default constructor.
*/
public
SessionMgmtBean
()
{
// TODO Auto-generated constructor stub
}
private
final
ConcurrentHashMap
<
String
,
UserContainer
>
sessionUsers
=
new
ConcurrentHashMap
<>();
private
final
Set
<
HttpSession
>
sessions
=
Collections
.
newSetFromMap
(
new
ConcurrentHashMap
<
HttpSession
,
Boolean
>());
@SuppressWarnings
(
"unused"
)
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
SessionMgmtBean
.
class
);
/**
* Default constructor.
*/
public
SessionMgmtBean
()
{
}
@Override
public
void
updateSessionUser
(
String
sessionId
,
String
user
)
{
if
(!
sessionUsers
.
containsKey
(
sessionId
))
{
sessionUsers
.
put
(
sessionId
,
new
UserContainer
(
BortalLocalContextHolder
.
getHostname
(),
user
));
sessionUsers
.
put
IfAbsent
(
sessionId
,
new
UserContainer
(
BortalLocalContextHolder
.
getHostname
(),
user
));
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment