Ver Mensaje Individual
  #4 (permalink)  
Antiguo 18/01/2014, 15:07
oskrok
 
Fecha de Ingreso: febrero-2006
Mensajes: 43
Antigüedad: 18 años, 2 meses
Puntos: 1
Respuesta: Llamar a una función en un momento exacto.

Listo, lo que me has puesto me ha funcionado perfectamente, para no tener que llamarlo en ningún lado he creado una clase y construido un método con la anotación @PostConstruct

Código PHP:
package com.omb.betserver.model.reviewerEvent;

import java.util.Timer;
import java.util.TimerTask;

import javax.annotation.PostConstruct;

public class 
ReviewerEvent {
     
    
TimerTask timerTask = new TimerTask()
     {
        public 
void run() 
        {
            
System.out.println("hola");
        }
     }; 
     
     public 
ReviewerEvent()
     {
         
     }
     
     @
PostConstruct
     
public void init()
     {
      
// Aquí se pone en marcha el timer cada segundo     
      
Timer timer = new Timer(); 
         
      
// Dentro de 0 milisegundos avísame cada 1000 milisegundos
      
timer.scheduleAtFixedRate(timerTask01000);          
     }

Y después creo un bean y listo:
<bean id="reviewerevent" class="com.omb.betserver.model.reviewerEvent.Revie werEvent" />