• Synchronized method or synchronized block?

    同步方法同步代码

    youdao

  • The reason is that the synchronized block in Listing 5 prevents parallel execution.

    原因清单5同步代码阻止并行执行

    youdao

  • Under those conditions the values in the synchronized block will never be contended for.

    这种条件下同步中的永远不会存在竞争。

    youdao

  • Thread 1 exits the synchronized block and returns instance from the getInstance() method.

    线程1退出synchronizedgetInstance()方法返回实例

    youdao

  • The compiler is allowed to move statements into a synchronized blockjust not out of it.

    编译可以语句移入synchronized——而不仅仅是把语句移出。

    youdao

  • Lock coarsening occurs when adjacent synchronized blocks may be merged into one synchronized block.

    多个彼此靠近同步可以合并到一起,形成一个同步块的时候,就会进行化。

    youdao

  • When one thread is executing a synchronized block, any thread waiting to enter that block is stalled.

    线程正在执行同步时,任何等待进入块的线程都将被阻塞。

    youdao

  • Then, one thread enters the synchronized block to initialize instance, while the other is blocked.

    然后线程进入synchronized初始化instance一个线程则阻断。

    youdao

  • Why isn't calling wait(), notify() or notifyAll() without a synchronized block not a compiler error?

    为什么打电话给wait(),没有同步不是一个编译错误notify()notifyall()?

    youdao

  • In Listing 6, the loop is out of a synchronized block, so it can be executed by several threads in parallel.

    清单6中,循环同步语句所以可能多个线程并行执行

    youdao

  • Creating the synchronized block yielded 16 lines of bytecode, whereas synchronizing the method returned just 5.

    创建同步代码产生16行的字节码创建同步方法产生了5行。

    youdao

  • Note that when the second thread enters the synchronized block, it does not check to see if instance is non-null.

    注意第二线程进入synchronized时,没有检查instance是否非null

    youdao

  • When the first thread exits the synchronized block, the waiting thread enters and creates another Singleton object.

    第一线程退出synchronized时,等待着的线程进入创建另一个Singleton对象

    youdao

  • When the thread exits the synchronized block of code, the lock is released, no matter how the thread exits the block.

    执行结束程式同步化区块时,锁定释放,不管执行绪如何结束区块。

    youdao

  • Do code path analysis to see if there is a synchronized block in the code that is blocking requests to execute concurrently.

    进行代码路径分析查看阻塞请求并发执行代码是否存在同步阻塞

    youdao

  • It tries to do this by introducing the local variable inst and a second synchronized block. The theory works as follows.

    试图通过引入局部变量inst第二synchronized解决问题。

    youdao

  • The percentage performance penalty implied by this fixed delay depends on how much work is being done in the synchronized block.

    一固定延迟带来的性能损失百分比取决于同步块内多少工作

    youdao

  • Some concurrency bugs won't break your code, but they can lead to poor application performance. Consider the synchronized block in Listing 5

    有一些并发缺陷有时不会使代码出错但是它们可能会降低应用程序性能

    youdao

  • In light of our observation it seems as if we should be able to optimize access in the case where a thread is looping over a synchronized block of code.

    根据我们观察我们似乎需要一些锁的访问进行优化,比如线程执行同步代码循环体中。

    youdao

  • And, if this process is applied repeatedly, the entire loop can be collapsed into a single synchronized block with a single "counter=10000000" operation.

    而且如果重复应用这个过程整个循环缩水单独同步,这个同步块中只有一个 "counter=10000000"操作

    youdao

  • When a thread exits a synchronized block as part of releasing the associated monitor, the JMM requires that the local processor cache be flushed to main memory.

    线程释放相关监视器而退出一个同步时,J MM要求本地处理器缓冲刷新存中

    youdao

  • Also, each Home instance is cached once found, so that subsequent lookups will obtain it from the cache, and this cache access is protected with a synchronized block.

    而且一旦找到缓存的主机实例随后查找都可以缓存获取这种缓存访问受到同步块的保护。

    youdao

  • If you have two operations that require synchronization separated by a small block of thread-safe code, you are generally better just using a single synchronized block.

    要是一小线程安全代码要求同步两个操作隔开那么使用一个同步一般更好些

    youdao

  • Similarly, attempting to acquire an intrinsic lock (enter a synchronized block) cannot be interrupted, but ReentrantLock supports an interruptible acquisition mode.

    类似地尝试获取内部的操作(进入synchronized)不能被中断的,但是ReentrantLock支持中断获取模式。

    youdao

  • If it is not small enough, you should analyze your code and refactor it in such a way that anything that could run asynchronously is located outside of the synchronized block.

    如果同步代码不够应该对代码进行分析,对其重构,以使所有可以异步运行代码均位于同步代码块之外

    youdao

  • In WebSphere Process Server V7, the method to claim a task USES a query table and combines the query and claim methods previously used to eliminate the need for the synchronized block.

    WebSphereProcessServerv 7中声明任务方法一个查询表结合早期用于消除同步需求查询声明方法

    youdao

  • Similarly, as part of acquiring the monitor when entering a synchronized block, local caches are invalidated so that subsequent reads will go directly to main memory and not the local cache.

    与此类似作为获得监视一部分,进入一个同步时,本地缓存失效使之后的操作直接进入内存不是本地缓存。

    youdao

  • It also ensures that the compiler does not move instructions from inside a synchronized block to outside (although it can in some cases move instructions from outside a synchronized block inside).

    确保编译器不会指令一个同步内部外部(虽然某些情况下把指令从同步块的外部移到内部)。

    youdao

  • Most programmers know that the synchronized keyword enforces a mutex (mutual exclusion) that prevents more than one thread at a time from entering a synchronized block protected by a given monitor.

    大多数程序员都知道synchronized关键字强制实施互斥锁(互相排斥),这个互斥锁防止每次多个线程进入一个给定监控器所保护同步语句

    youdao

  • While no one would ever directly use the idiom in Listing 1, this code is very similar to the case where the lock associated with a synchronized block can be proven to be a thread-local variable.

    虽然没有直接使用清单1中的形式,但是这个代码非常类似情况是:可以证实synchronized关联一个线程本地变量

    youdao

$firstVoiceSent
- 来自原声例句
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定