當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript ice.Ice.Promise類代碼示例

本文整理匯總了TypeScript中ice.Ice.Promise的典型用法代碼示例。如果您正苦於以下問題:TypeScript Ice.Promise類的具體用法?TypeScript Ice.Promise怎麽用?TypeScript Ice.Promise使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Ice.Promise類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: runTestCase

 async runTestCase(adapter:Test.RemoteObjectAdapterPrx, proxy:Test.TestIntfPrx)
 {
     //
     // Put the adapter on hold. The server will not respond to
     // the graceful close. This allows to test whether or not
     // the close is graceful or forceful.
     //
     await adapter.hold();
     await Ice.Promise.delay(3000);
     test(this._heartbeat === 0);
     test(!this._closed); // Not closed yet because of graceful close.
     await adapter.activate();
     await Ice.Promise.delay(1000);
     await this.waitForClosed(); // Connection should be closed this time.
 }
開發者ID:zeroc-ice,項目名稱:ice-debian-packaging,代碼行數:15,代碼來源:Client.ts

示例2: callbackOK

 callbackOK():PromiseLike<void>
 {
     return this._p.then(() =>
                         {
                             this._callback = false;
                             this._p = new Ice.Promise();
                         });
 }
開發者ID:zeroc-ice,項目名稱:ice-debian-packaging,代碼行數:8,代碼來源:Client.ts

示例3: waitForClosed

 async waitForClosed()
 {
     const now = Date.now();
     while(!this._closed)
     {
         await Ice.Promise.delay(100);
         if(Date.now() - now >= 2000)
         {
             test(false); // Waited for more than 2s for close, something's wrong.
         }
     }
 }
開發者ID:zeroc-ice,項目名稱:ice-debian-packaging,代碼行數:12,代碼來源:Client.ts

示例4: connect

 async function connect(prx:Test.TimeoutPrx)
 {
     let nRetry = 10;
     while(--nRetry > 0)
     {
         try
         {
             await prx.ice_getConnection();
             break;
         }
         catch(ex)
         {
             // Can sporadically occur with slow machines
             test(ex instanceof Ice.ConnectTimeoutException ||
                     ex instanceof Ice.ConnectFailedException, ex);
         }
         await Ice.Promise.delay(100);
     }
     return prx.ice_getConnection();
 }
開發者ID:zeroc-ice,項目名稱:ice-debian-packaging,代碼行數:20,代碼來源:Client.ts

示例5: allTests


//.........這裏部分代碼省略.........
        }
        catch(ex)
        {
            test(ex instanceof Ice.MemoryLimitException, ex);
        }

        try
        {
            await thrower.throwMemoryLimitException(new Uint8Array(20 * 1024));
            test(false);
        }
        catch(ex)
        {
            test(ex.toString().indexOf("ConnectionLostException") > 0, ex);
        }
        out.writeLine("ok");

        let retries = 10;
        while(--retries > 0)
        {
            // The above test can cause a close connection between the echo server and
            // bidir server, we need to wait until the bidir server has reopen the
            // connection with the echo server.

            try
            {
                await thrower.ice_ping();
                break;
            }
            catch(ex)
            {
                if(ex instanceof Ice.ObjectNotExistException && retries > 0)
                {
                    await Ice.Promise.delay(20);
                }
                else
                {
                    throw ex;
                }
            }
        }

        out.write("catching object not exist exception... ");
        try
        {
            const thrower2 = Test.ThrowerPrx.uncheckedCast(
                thrower.ice_identity(Ice.stringToIdentity("does not exist")));
            await thrower2.ice_ping();
            test(false);
        }
        catch(ex)
        {
            test(ex instanceof Ice.ObjectNotExistException, ex);
            test(ex.id.equals(Ice.stringToIdentity("does not exist")));
        }
        out.writeLine("ok");

        out.write("catching facet not exist exception... ");
        try
        {
            const thrower2 = Test.ThrowerPrx.uncheckedCast(thrower, "no such facet");
            await thrower2.ice_ping();
            test(false);
        }
        catch(ex)
        {
開發者ID:zeroc-ice,項目名稱:ice-debian-packaging,代碼行數:67,代碼來源:Client.ts


注:本文中的ice.Ice.Promise類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。