-
-
Save Miltex/1fb74f1188cc4a81cee482f6bbc78d1e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SuppressWarnings("serial") | |
@Stateless | |
public class Cron implements Serializable { | |
@Schedule(hour = "1,2,3,4,5,6", minute = "*", persistent = false) | |
@TransactionAttribute(TransactionAttributeType.NEVER) | |
public void sincronizaPessoa() throws Exception { | |
} | |
private void envia_email_erro_cron(long inicio, String seqAvaliada, String msg, String metodo, Exception e) { | |
// long fim; | |
// fim = System.currentTimeMillis(); | |
// e.printStackTrace(); | |
// System.out.println("#################### " + msg + " : " + seqAvaliada + " <br>\r\n Tempo: " + ((fim - inicio) / 1000)); | |
// try { | |
// MailUtil.enviarMail(ParametroLookup.email_endereco_remetente(), ParametroLookup.email_destinatario(), "integradorV2", msg, "CronPesquisaNomeBO." + metodo + "() <br>\r\n " + msg + " : " + seqAvaliada + " <br>\r\n Tempo: " + ((fim - inicio) / 1000)); | |
// } catch (Exception e1) { | |
// e1.printStackTrace(); | |
// } | |
} | |
/* | |
* Atualização do nome do processo | |
*/ | |
@Schedule(hour = "1,2,3,4,5,6", minute = "*", persistent = false) | |
@TransactionAttribute(TransactionAttributeType.NEVER) | |
public synchronized void sincronizaProcesso(){ | |
} | |
/* | |
* Atualização da reserva de nome. | |
*/ | |
@Schedule(hour = "*", minute = "*/5", persistent = false) | |
@TransactionAttribute(TransactionAttributeType.NEVER) | |
public synchronized void sincronizateste() { | |
if(!Constantes.executa_cron){ | |
return; | |
} | |
long inicio = System.currentTimeMillis(); | |
String seqAvaliada = null; | |
try { | |
List<ReservaNome> listaReservaNome = reservaNomeDAO.obtemListaReservaNomeParaAtualizarPesquisaNome(5); | |
for (ReservaNome resevaNome : listaReservaNome) { | |
seqAvaliada = resevaNome.getId().toString(); | |
pesquisaNomeBO.criaOuAtualizaPesquisaNome(resevaNome); | |
} | |
} catch (IntegradorV2Exception e) { | |
envia_email_erro_cron(inicio, seqAvaliada, "Erro no processo", "sincronizaReservaNome", e); | |
} catch (Exception e) { | |
envia_email_erro_cron(inicio, seqAvaliada, "Erro no processo", "sincronizaReservaNome", e); | |
} | |
} | |
@Schedule(hour = "1,2,3,4,5,6", minute="*/20", persistent = false) | |
@TransactionAttribute(TransactionAttributeType.NEVER) | |
public synchronized void teste() { | |
} | |
/* | |
* Inativa reservas de nome vencidas | |
*/ | |
@Schedule(hour = "1,2,3,4,5,6", persistent = false) | |
@TransactionAttribute(TransactionAttributeType.NEVER) | |
public synchronized void teste() { | |
} | |
/* | |
* Inativa processos com mais de 180 dias | |
*/ | |
@Schedule(hour = "1,2,3,4,5,6", persistent = false) | |
@TransactionAttribute(TransactionAttributeType.NEVER) | |
public synchronized void teste() { | |
} | |
@Schedule(hour = "1,2,3,4,5,6,12,17,19,20", persistent = false) | |
@TransactionAttribute(TransactionAttributeType.NEVER) | |
public synchronized void teste() { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment