Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Linnea Samila
/
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 2c6396cb
authored
Dec 10, 2014
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add method for fetching the position of user in the queue.
1 parent
34646e33
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
1 deletions
code/moya-beans/ejbModule/fi/codecrew/moya/beans/QueueBean.java
code/moya-beans/ejbModule/fi/codecrew/moya/beans/QueueBean.java
View file @
2c6396c
...
...
@@ -139,6 +139,23 @@ public class QueueBean implements QueueBeanLocal {
return
ret
;
}
public
Integer
getPosition
(
EventUser
user
)
{
Integer
ret
=
null
;
if
(
reserving
.
contains
(
user
))
{
ret
=
0
;
}
else
if
(
queue
.
contains
(
user
))
{
ret
=
1
;
for
(
EventUser
eu
:
queue
)
{
if
(
eu
.
equals
(
user
))
{
break
;
}
++
ret
;
}
}
return
ret
;
}
}
@EJB
...
...
@@ -177,7 +194,7 @@ public class QueueBean implements QueueBeanLocal {
}
// DO housekeeping every 10 seconds.
nextReservingTimeoutCheck
.
compareAndSet
(
oldTime
,
System
.
currentTimeMillis
()
+
1000
*
10
);
nextReservingTimeoutCheck
.
compareAndSet
(
oldTime
,
System
.
currentTimeMillis
()
+
1000
*
10
);
}
catch
(
Throwable
t
)
{
logger
.
warn
(
"Exception while checking reservingTimeouts"
);
}
...
...
@@ -194,6 +211,12 @@ public class QueueBean implements QueueBeanLocal {
}
@Lock
(
LockType
.
READ
)
public
Integer
getQueuePosition
(
EventMap
map
,
EventUser
user
)
{
return
getMapque
(
map
).
getPosition
(
user
);
}
@Lock
(
LockType
.
READ
)
public
boolean
isQueueEnabled
()
{
boolean
ret
=
false
;
LanEventProperty
mapque
=
eventbean
.
getProperty
(
LanEventPropertyKey
.
MAP_QUEUE
);
...
...
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