Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Pedro J Sanchez
/
simulaeventos
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
3dd3a12f
authored
Mar 27, 2020
by
Pedro J Sanchez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Upload New File
parent
834a5e5d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
0 deletions
src/main/java/es/uja/cursojee/simulaeventos/TareaResultado.java
src/main/java/es/uja/cursojee/simulaeventos/TareaResultado.java
0 → 100644
View file @
3dd3a12f
package
es
.
uja
.
cursojee
.
simulaeventos
;
import
java.util.List
;
import
java.util.concurrent.ExecutionException
;
import
java.util.concurrent.Future
;
public
class
TareaResultado
implements
Runnable
{
private
final
String
name
;
private
final
List
<
Future
<
List
<
Evento
>>>
listaResultados
;
public
TareaResultado
(
String
name
,
List
<
Future
<
List
<
Evento
>>>
listaResultados
)
{
super
();
this
.
name
=
name
;
this
.
listaResultados
=
listaResultados
;
}
@Override
public
void
run
()
{
System
.
out
.
println
(
"Hilo("
+
name
+
") ha iniciado su ejecución"
);
try
{
presentarResultado
();
System
.
out
.
println
(
"Hilo("
+
name
+
") ha finalizado su ejecución"
);
}
catch
(
InterruptedException
|
ExecutionException
e
)
{
// TODO Auto-generated catch block
System
.
out
.
println
(
"Hilo("
+
name
+
") se CANCELA su ejecución"
);
}
}
private
void
presentarResultado
()
throws
InterruptedException
,
ExecutionException
{
List
<
Evento
>
listaEventos
;
for
(
Future
<
List
<
Evento
>>
resultado
:
listaResultados
)
{
listaEventos
=
resultado
.
get
();
System
.
out
.
println
(
"Hilo("
+
name
+
") el número de eventos CREADOS es "
+
listaEventos
.
size
());
}
}
public
String
getName
()
{
return
name
;
}
}
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