try {
//try to get the Class object, if we are running in iAS this will work
Class cls = Class.forName("com.sun.enterprise.Switch");
Class param[] = new Class[0];
//get the getSwitch method
Method meth = cls.getMethod("getSwitch",param);
//invoke the getSwitch method will return the Switch
Object obj = meth.invoke(cls,(java.lang.Object[])param);
//get the Switch class object
//cls = obj.getClass();
//get the getTimer method
meth = cls.getMethod("getTimer",param);
//invoke the getTimer method
obj = meth.invoke(obj,(java.lang.Object[])param);
//return the Timer
return (Timer)obj;
} catch (ClassNotFoundException ex) {
//if we are not running in iAS then create a new Timer
return new Timer(true);
} catch (Exception ex) {
//_logger.log(Level.FINE,ex.toString());
return new Timer(true);
}