Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 30 for Executor (0.16 sec)

  1. okhttp/src/test/java/okhttp3/internal/http2/MockHttp2Peer.kt

      private var writer = Http2Writer(bytesOut, client)
      private val outFrames: MutableList<OutFrame> = ArrayList()
      private val inFrames: BlockingQueue<InFrame> = LinkedBlockingQueue()
      private var port = 0
      private val executor = Executors.newSingleThreadExecutor(threadFactory("MockHttp2Peer"))
      private var serverSocket: ServerSocket? = null
      private var socket: Socket? = null
    
      fun setClient(client: Boolean) {
        if (this.client == client) return
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Thu Apr 11 22:09:35 GMT 2024
    - 8.7K bytes
    - Viewed (0)
  2. okhttp/src/main/kotlin/okhttp3/internal/connection/RealCall.kt

          get() = originalRequest
    
        val call: RealCall
          get() = this@RealCall
    
        /**
         * Attempt to enqueue this async call on [executorService]. This will attempt to clean up
         * if the executor has been shut down by reporting the call as failed.
         */
        fun executeOn(executorService: ExecutorService) {
          client.dispatcher.assertThreadDoesntHoldLock()
    
          var success = false
          try {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Apr 20 17:03:43 GMT 2024
    - 17.9K bytes
    - Viewed (2)
  3. regression-test/src/androidTest/java/okhttp/regression/compare/AndroidHttpEngineTest.kt

          .build()
    
      @After
      fun tearDown() {
        engine.shutdown()
        cacheDir.deleteRecursively()
      }
    
      @Test
      fun get() {
        val executor = Executors.newCachedThreadPool()
    
        val completableFuture = execute(engine, executor, "https://google.com/robots.txt")
    
        try {
          val response = completableFuture.get(10, TimeUnit.SECONDS)
    
          assertEquals(200, response.code)
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun Mar 24 13:19:43 GMT 2024
    - 6.2K bytes
    - Viewed (0)
  4. okhttp/src/test/java/okhttp3/internal/cache2/RelayTest.kt

    class RelayTest {
      @TempDir
      var tempDir: File? = null
      private val executor = Executors.newCachedThreadPool(threadFactory("RelayTest"))
      private val metadata: ByteString = "great metadata!".encodeUtf8()
      private lateinit var file: File
    
      @BeforeEach
      fun setUp() {
        file = File(tempDir, "test")
      }
    
      @AfterEach
      fun tearDown() {
        executor.shutdown()
      }
    
      @Test
      fun singleSource() {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Thu Apr 11 22:09:35 GMT 2024
    - 8.1K bytes
    - Viewed (0)
  5. okhttp/src/test/java/okhttp3/DispatcherTest.kt

        dispatcher.maxRequestsPerHost = 4
        executor.assertJobs("http://a/1", "http://a/2", "http://a/3", "http://a/4")
      }
    
      @Test
      fun oldJobFinishesNewJobCanRunDifferentHost() {
        dispatcher.maxRequests = 1
        client.newCall(newRequest("http://a/1")).enqueue(callback)
        client.newCall(newRequest("http://b/1")).enqueue(callback)
        executor.finishJob("http://a/1")
        executor.assertJobs("http://b/1")
      }
    
      @Test
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Fri Apr 05 03:30:42 GMT 2024
    - 12.7K bytes
    - Viewed (0)
  6. okhttp/src/test/java/okhttp3/SocksProxy.kt

        )
      }
    
      fun connectionCount(): Int = connectionCount.get()
    
      fun shutdown() {
        serverSocket!!.close()
        executor.shutdown()
        if (!executor.awaitTermination(5, TimeUnit.SECONDS)) {
          throw IOException("Gave up waiting for executor to shut down")
        }
      }
    
      private fun service(from: Socket) {
        val name = "SocksProxy ${from.remoteSocketAddress}"
        threadName(name) {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Thu Apr 11 22:09:35 GMT 2024
    - 7.7K bytes
    - Viewed (0)
  7. samples/crawler/src/main/java/okhttp3/sample/Crawler.java

      }
    
      private void parallelDrainQueue(int threadCount) {
        ExecutorService executor = Executors.newFixedThreadPool(threadCount);
        for (int i = 0; i < threadCount; i++) {
          executor.execute(() -> {
            try {
              drainQueue();
            } catch (Exception e) {
              e.printStackTrace();
            }
          });
        }
        executor.shutdown();
      }
    
      private void drainQueue() throws Exception {
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Thu Aug 12 07:26:27 GMT 2021
    - 4.6K bytes
    - Viewed (0)
  8. okhttp-android/src/test/kotlin/okhttp3/android/ShadowDnsResolver.kt

        val flags: Int,
        val callback: DnsResolver.Callback<List<InetAddress>>,
      )
    
      @Implementation
      fun query(
        network: Network?,
        domain: String,
        nsType: Int,
        flags: Int,
        executor: Executor,
        cancellationSignal: CancellationSignal?,
        callback: DnsResolver.Callback<List<InetAddress>>,
      ) {
        responder(Request(network, domain, nsType, flags, callback))
      }
    
      companion object {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 22 20:07:09 GMT 2024
    - 1.7K bytes
    - Viewed (1)
  9. docs/contribute/concurrency.md

    Sometimes there's an action required like calling the application layer or responding to a ping, and the thread discovering the action is not the thread that should do the work. We enqueue a runnable on this executor and it gets handled by one of the executor's threads.
    
    ### Locks
    
    We have 3 different things that we synchronize on.
    
    #### Http2Connection
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sun Feb 06 16:35:36 GMT 2022
    - 7K bytes
    - Viewed (0)
  10. samples/guide/src/main/java/okhttp3/recipes/CancelCall.java

    package okhttp3.recipes;
    
    import java.io.IOException;
    import java.util.concurrent.Executors;
    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);
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Jan 12 03:31:36 GMT 2019
    - 2.1K bytes
    - Viewed (0)
Back to top