Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
joram
joram
Commits
2eae2eda
Commit
2eae2eda
authored
Oct 05, 2017
by
afreyssin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds a timed get used in distribution daemon (bridge destination).
parent
402185ae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
1 deletion
+20
-1
joram/a3/common/src/main/java/fr/dyade/aaa/common/Queue.java
joram/a3/common/src/main/java/fr/dyade/aaa/common/Queue.java
+20
-1
No files found.
joram/a3/common/src/main/java/fr/dyade/aaa/common/Queue.java
View file @
2eae2eda
/*
* Copyright (C) 2001 - 201
5
ScalAgent Distributed Technologies
* Copyright (C) 2001 - 201
7
ScalAgent Distributed Technologies
* Copyright (C) 1996 - 2000 BULL
* Copyright (C) 1996 - 2000 INRIA
*
...
...
@@ -101,6 +101,25 @@ public class Queue implements Serializable {
return
elements
.
get
(
0
);
}
/**
* Waits for an object to be pushed in the queue or a specified amount of time has elapsed.
* The first object is returned without removing it.
*
* @param timeout The maximum time to wait in milliseconds.
* @return The object at the top of this queue.
*/
public
synchronized
Object
get
(
long
timeout
)
throws
InterruptedException
{
if
(
size
()
==
0
&&
!
closed
)
wait
(
timeout
);
if
(
closed
)
throw
new
InterruptedException
();
if
(
size
()
>
0
)
return
elements
.
get
(
0
);
return
null
;
}
/**
* Removes and returns the object at the top of this queue.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
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 comment