/* */ package NET.worlds.console; /* */ /* */ import NET.worlds.core.IniFile; /* */ import java.io.IOException; /* */ import java.io.PrintStream; /* */ import java.util.Vector; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class ActiveX /* */ implements MainCallback, MainTerminalCallback /* */ { /* */ private static boolean disabled; /* */ private static ActiveX _instance; /* */ private static int _references; /* */ private static Vector _referrers; /* */ private static int _serverLocks; /* */ private static int _activeComponents; /* */ private static int _debugLevel; /* */ /* */ static /* */ { /* 39 */ disabled = IniFile.gamma().getIniInt( /* 40 */ "DISABLEACTIVEX", 0) != 0; /* */ /* */ /* */ /* 44 */ _referrers = new Vector(); /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* 53 */ _debugLevel = IniFile.gamma().getIniInt("oledebug", 0); /* 54 */ if (_debugLevel > 0) { /* 55 */ System.out.println("OLE DEBUGGING LEVEL = " + _debugLevel); /* */ } /* */ } /* */ /* */ public static int getDebugLevel() /* */ { /* 61 */ return _debugLevel; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static ActiveX getInstance() /* */ { /* 72 */ if (_instance == null) /* 73 */ _instance = new ActiveX(); /* 74 */ return _instance; /* */ } /* */ /* */ private ActiveX() /* */ { /* 79 */ Main.register(this); /* */ } /* */ /* */ /* */ public void mainCallback() /* */ { /* 85 */ winProc(); /* */ } /* */ /* 88 */ public int _shutdownCounter = 0; /* */ /* */ public void terminalCallback() /* */ { /* 92 */ assert (this == _instance); /* 93 */ if ((_serverLocks > 0) || (_activeComponents > 0)) { /* 94 */ this._shutdownCounter += 1; /* 95 */ if (this._shutdownCounter == 10) { /* 96 */ this._shutdownCounter = 0; /* 97 */ System.out.println("Shutdown ignored: _serverLocks = " + /* 98 */ _serverLocks + ", _activeComponents = " + /* 99 */ _activeComponents); /* 100 */ Exception e = new Exception(); /* 101 */ e.printStackTrace(System.out); /* */ } /* 103 */ return; /* */ } /* */ /* */ /* 107 */ synchronized (this) { /* 108 */ if ((!$assertionsDisabled) && (_references != _referrers.size())) throw new AssertionError(); /* 109 */ while (_references > 0) /* */ { /* */ /* 112 */ for (int i = _referrers.size() - 1; i >= 0; i--) { /* 113 */ IUnknown pUnk = (IUnknown)_referrers.elementAt(i); /* */ try { /* 115 */ pUnk.Release(); /* */ } catch (OLEInvalidObjectException e) { /* 117 */ e.printStackTrace(System.out); /* 118 */ System.out /* 119 */ .println("ActiveX: misbehaved object detected: " + /* 120 */ pUnk); /* 121 */ _referrers.removeElementAt(i); /* */ } /* */ } /* */ /* */ /* 126 */ if (_referrers.size() > 0) { /* 127 */ System.out.println("ActiveX: bad referrers found:"); /* 128 */ for (int i = _referrers.size() - 1; i >= 0; i--) { /* 129 */ IUnknown pUnk = (IUnknown)_referrers.elementAt(i); /* 130 */ System.out.println("\t" + pUnk); /* */ } /* */ } /* */ } /* */ /* 135 */ assert (_references == 0); /* 136 */ Main.unregister(this); /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static void init(IUnknown referrer) /* */ throws IOException /* */ { /* 150 */ synchronized () { /* 151 */ assert (!_referrers.contains(referrer)); /* 152 */ if (_references == 0) { /* 153 */ initActiveX(); /* */ } /* */ /* */ /* 157 */ _references += 1; /* 158 */ _referrers.addElement(referrer); /* */ /* 160 */ if ((_debugLevel & 0x1) > 0) { /* 161 */ System.out.println("ActiveX.init() - refCnt = " + /* 162 */ _references); /* */ } /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static void uninit(IUnknown referrer) /* */ { /* 174 */ synchronized () { /* 175 */ assert (_references > 0); /* 176 */ assert (_referrers.contains(referrer)); /* 177 */ _references -= 1; /* 178 */ if (_references == 0) /* 179 */ uninitActiveX(); /* 180 */ _referrers.removeElement(referrer); /* */ /* 182 */ if ((_debugLevel & 0x1) > 0) { /* 183 */ System.out.println("ActiveX.uninit() - refCnt = " + /* 184 */ _references); /* */ } /* */ } /* */ } /* */ /* */ public static synchronized void incServerLocks(int amt) { /* 190 */ _serverLocks += amt; /* 191 */ assert (_serverLocks >= 0); /* */ } /* */ /* */ public static synchronized void incActiveComponents(int amt) { /* 195 */ _activeComponents += amt; /* 196 */ assert (_activeComponents >= 0); /* */ } /* */ /* */ private static native void initActiveX() /* */ throws IOException; /* */ /* */ private static native void uninitActiveX(); /* */ /* */ public static native int getClassFClsID(String paramString1, String paramString2) /* */ throws IOException; /* */ /* */ public static native int getClassFProgID(String paramString1, String paramString2) /* */ throws IOException; /* */ /* */ private static native int getClass(int paramInt, String paramString) /* */ throws IOException; /* */ /* */ private native void winProc(); /* */ } /* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\console\ActiveX.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */