Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
SalidasAutomaticas
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Billy Larru
SalidasAutomaticas
Commits
0665992c
Commit
0665992c
authored
Apr 05, 2018
by
Billy Larru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
usando timer y timertask
parent
7fcea978
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
28 deletions
+31
-28
Main.java
src/salidasautomaticas/main/Main.java
+9
-28
Temporizador.java
src/salidasautomaticas/schedule/Temporizador.java
+22
-0
No files found.
src/salidasautomaticas/main/Main.java
View file @
0665992c
package
salidasautomaticas
.
main
;
package
salidasautomaticas
.
main
;
import
java.util.logging.Level
;
import
java.util.Timer
;
import
java.util.logging.Logger
;
import
salidasautomaticas.schedule.Temporizador
;
import
static
org
.
quartz
.
CronScheduleBuilder
.
cronSchedule
;
import
salidasautomaticas.services.SalidasServices
;
import
org.quartz.CronTrigger
;
import
static
org
.
quartz
.
JobBuilder
.
newJob
;
import
org.quartz.JobDetail
;
import
org.quartz.Scheduler
;
import
org.quartz.SchedulerException
;
import
org.quartz.SchedulerFactory
;
import
static
org
.
quartz
.
TriggerBuilder
.
newTrigger
;
import
org.quartz.impl.StdSchedulerFactory
;
import
salidasautomaticas.schedule.Planificador
;
import
salidasautomaticas.schedule.ProgramarSalidasJob
;
public
class
Main
{
public
class
Main
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
SchedulerFactory
sf
=
Planificador
.
getInstance
().
getSchedulerFactory
();
Timer
timer
=
new
Timer
();
Scheduler
scheduler
;
// SalidasServices services = new SalidasServices();
try
{
// System.out.println(services.obtenerHorariosSalida());
scheduler
=
sf
.
getScheduler
();
JobDetail
job
=
newJob
(
ProgramarSalidasJob
.
class
).
withIdentity
(
"job1"
,
"group1"
).
build
();
CronTrigger
trigger
=
newTrigger
().
withIdentity
(
"trigger1"
,
"group1"
).
withSchedule
(
cronSchedule
(
"0 43 15 * * ?"
))
.
build
();
scheduler
.
scheduleJob
(
job
,
trigger
);
timer
.
schedule
(
new
Temporizador
(),
0
,
3000
);
scheduler
.
start
();
}
catch
(
SchedulerException
ex
)
{
Logger
.
getLogger
(
Main
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
ex
);
}
}
}
}
}
src/salidasautomaticas/schedule/Temporizador.java
0 → 100644
View file @
0665992c
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package
salidasautomaticas
.
schedule
;
import
java.util.Date
;
import
java.util.TimerTask
;
/**
*
* @author sistem19user
*/
public
class
Temporizador
extends
TimerTask
{
@Override
public
void
run
()
{
System
.
out
.
println
(
new
Date
());
}
}
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