FileDocCategorySizeDatePackage
PortabilityUtils.javaAPI DocGlassfish v2 API3896Fri May 04 22:35:14 BST 2007com.sun.enterprise.resource

PortabilityUtils

public class PortabilityUtils extends Object
This is a utility class.

Fields Summary
Constructors Summary
public PortabilityUtils()
Creates new PortabilityUtils

    
Methods Summary
public static java.util.TimergetTimer()

return
Timer object.

        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);
        }