Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 12 for cancelAll (0.22 sec)

  1. okhttp/src/test/java/okhttp3/internal/concurrent/TaskRunnerTest.kt

        redQueue.execute("task", 100.µs) {
          log += "run@${taskFaker.nanoTime}"
        }
    
        taskFaker.advanceUntil(0.µs)
        assertThat(log).isEmpty()
    
        redQueue.cancelAll()
    
        taskFaker.advanceUntil(99.µs)
        assertThat(log).isEmpty()
    
        taskFaker.assertNoMoreTasks()
    
        assertThat(testLogHandler.takeAll()).containsExactly(
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 20K bytes
    - Viewed (0)
  2. okhttp/src/main/kotlin/okhttp3/internal/concurrent/TaskRunner.kt

              try {
                backend.coordinatorWait(this@TaskRunner, minDelayNanos)
              } catch (_: InterruptedException) {
                // Will cause all tasks to exit unless more are scheduled!
                cancelAll()
              } finally {
                coordinatorWaiting = false
              }
            }
          }
        }
      }
    
      fun newQueue(): TaskQueue {
        val name = lock.withLock { nextQueueName++ }
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 9.6K bytes
    - Viewed (0)
  3. okhttp/src/main/kotlin/okhttp3/internal/connection/RealConnectionPool.kt

        return if (connection.noNewExchanges || maxIdleConnections == 0) {
          connection.noNewExchanges = true
          connections.remove(connection)
          if (connections.isEmpty()) cleanupQueue.cancelAll()
          scheduleOpener(connection.route.address)
          true
        } else {
          scheduleCloser()
          false
        }
      }
    
      fun evictAll() {
        val i = connections.iterator()
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sat Apr 20 17:03:43 GMT 2024
    - 16.2K bytes
    - Viewed (0)
  4. okhttp/src/main/kotlin/okhttp3/internal/concurrent/TaskQueue.kt

       * will not be made until any currently-executing task has completed. Tasks that return true will
       * be removed from the execution schedule.
       */
      fun cancelAll() {
        lock.assertNotHeld()
    
        taskRunner.lock.withLock {
          if (cancelAllAndDecide()) {
            taskRunner.kickCoordinator(this)
          }
        }
      }
    
      fun shutdown() {
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 7.5K bytes
    - Viewed (0)
  5. okhttp-testing-support/src/main/kotlin/okhttp3/OkHttpClientTestRule.kt

          val waitTime = (entryTime + 1_000_000_000L - System.nanoTime())
          if (!queue.idleLatch().await(waitTime, TimeUnit.NANOSECONDS)) {
            TaskRunner.INSTANCE.lock.withLock {
              TaskRunner.INSTANCE.cancelAll()
            }
            fail<Unit>("Queue still active after 1000 ms")
          }
        }
      }
    
      override fun beforeEach(context: ExtensionContext) {
        testName = context.displayName
    
        beforeEach()
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 10.5K bytes
    - Viewed (0)
  6. okhttp/src/main/kotlin/okhttp3/Dispatcher.kt

        }
        return null
      }
    
      /**
       * Cancel all calls currently enqueued or executing. Includes calls executed both
       * [synchronously][Call.execute] and [asynchronously][Call.enqueue].
       */
      fun cancelAll() {
        this.withLock {
          for (call in readyAsyncCalls) {
            call.call.cancel()
          }
          for (call in runningAsyncCalls) {
            call.call.cancel()
          }
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sat Apr 20 17:03:43 GMT 2024
    - 9K bytes
    - Viewed (0)
  7. okhttp/src/test/java/okhttp3/KotlinSourceModernTest.kt

        val runningCalls: List<Call> = dispatcher.runningCalls()
        val queuedCallsCount: Int = dispatcher.queuedCallsCount()
        val runningCallsCount: Int = dispatcher.runningCallsCount()
        dispatcher.cancelAll()
      }
    
      @Test
      fun dispatcherFromMockWebServer() {
        val dispatcher =
          object : okhttp3.mockwebserver.Dispatcher() {
            override fun dispatch(request: RecordedRequest): MockResponse = TODO()
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Apr 01 14:21:25 GMT 2024
    - 46.5K bytes
    - Viewed (4)
  8. okhttp/src/test/java/okhttp3/CallTest.kt

        latch.countDown()
        callback.await(server.url("/a")).assertFailure("Canceled", "Socket closed", "Socket is closed")
      }
    
      @Test
      fun cancelAll() {
        val call = client.newCall(Request(server.url("/")))
        call.enqueue(callback)
        client.dispatcher.cancelAll()
        callback.await(server.url("/")).assertFailure("Canceled", "Socket closed", "Socket is closed")
      }
    
      @Test
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Wed Apr 10 19:46:48 GMT 2024
    - 142.5K bytes
    - Viewed (0)
  9. samples/guide/src/main/java/okhttp3/recipes/kt/CancelCall.kt

     */
    package okhttp3.recipes.kt
    
    import java.io.IOException
    import java.util.concurrent.Executors
    import java.util.concurrent.TimeUnit
    import okhttp3.OkHttpClient
    import okhttp3.Request
    
    class CancelCall {
      private val executor = Executors.newScheduledThreadPool(1)
      private val client = OkHttpClient()
    
      fun run() {
        val request =
          Request.Builder()
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.9K bytes
    - Viewed (0)
  10. samples/guide/src/main/java/okhttp3/recipes/CancelCall.java

    import java.util.concurrent.ScheduledExecutorService;
    import java.util.concurrent.TimeUnit;
    import okhttp3.Call;
    import okhttp3.OkHttpClient;
    import okhttp3.Request;
    import okhttp3.Response;
    
    public class CancelCall {
      private final ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
      private final OkHttpClient client = new OkHttpClient();
    
      public void run() throws Exception {
    Java
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sat Jan 12 03:31:36 GMT 2019
    - 2.1K bytes
    - Viewed (0)
Back to top