首页 \ 问答 \ 为什么COMMIT在执行立即后解决了问题?(Why COMMIT resolved the issue after execute immediate?)

为什么COMMIT在执行立即后解决了问题?(Why COMMIT resolved the issue after execute immediate?)

BEGIN
     EXECUTE IMMEDIATE 'ALTER SESSION SET SKIP_UNUSABLE_INDEXES = TRUE';
     EXECUTE IMMEDIATE 'ALTER SESSION DISABLE PARALLEL DML' ;
END;
/

在3个oracle服务器中的1个中获得跟随错误。 oracle:11.2.0.4

ora 12841无法在事务中更改会话并行DML状态

但是在添加COMMIT后系统工作正常

BEGIN
     EXECUTE IMMEDIATE 'ALTER SESSION SET SKIP_UNUSABLE_INDEXES = TRUE';
     COMMIT;
     EXECUTE IMMEDIATE 'ALTER SESSION DISABLE PARALLEL DML' ;
END;
/

添加COMMIT后为什么没有看到这个问题?


BEGIN
     EXECUTE IMMEDIATE 'ALTER SESSION SET SKIP_UNUSABLE_INDEXES = TRUE';
     EXECUTE IMMEDIATE 'ALTER SESSION DISABLE PARALLEL DML' ;
END;
/

getting following error in 1 out of 3 oracle servers. oracle : 11.2.0.4

ora 12841 cannot alter the session parallel DML state within a transaction

But the system worked fine after adding COMMIT

BEGIN
     EXECUTE IMMEDIATE 'ALTER SESSION SET SKIP_UNUSABLE_INDEXES = TRUE';
     COMMIT;
     EXECUTE IMMEDIATE 'ALTER SESSION DISABLE PARALLEL DML' ;
END;
/

Why that issue not seen after adding COMMIT?


原文:https://stackoverflow.com/questions/29458076
更新时间:2022-09-04 08:09

最满意答案

我听说RunOnUiThread方法将一个runnableRunOnUiThread的{}块)发布到UI线程的handler 。 然后UI线程将在不忙时执行runnable.run()方法。 如你所知,UI 必须有一段时间让我们不忙,因为如果没有,它会导致系统显示ANR(应用程序没有响应)消息(甚至当UI线程尝试运行耗时时它会抛出Exception (滞后)工作,如网络:))。

** edit **这是一个java代码,向您展示runOnUiThread工作原理。 引自此博客(韩文)

@Override
public final void runOnUiThread(Runnable action)
{
    if (Thread.currentThread() !=mUiThread)
    {
        mHandler.post(action);
    }
    else
    {
        action.run();
    }
}

PS我不是kotlin的出口,但我希望我的回答对你有帮助。 抱歉我的英语不好。


I heard that RunOnUiThread method posts a runnable( the {} block in kotlin) to the handler of the UI thread. Then the UI thread will execute the runnable.run() method when it is not busy. As you know there must be a time when the UI thread us not busy, because it will cause the system to show ANR(applicafion not responding) message if not (And even it throwsExceptions when the UI thread tries to run time-consuming(lagging) jobs like networking :)).

**edit ** Here's a java code that shows you how runOnUiThread works. Cited from this blog (Korean)

@Override
public final void runOnUiThread(Runnable action)
{
    if (Thread.currentThread() !=mUiThread)
    {
        mHandler.post(action);
    }
    else
    {
        action.run();
    }
}

P.S. I am not an export in kotlin, but I hope my answer helped you.

相关问答

更多
  • 你有几种方法。 最简单的方法是使用Activity.runOnUiThread()方法(有关详细信息,请参阅此处 )。 你也可以使用Handler来实现这一点,它可以互相连接两个不同的Thread 。 您可以在UI线程中定义Handler ,将其传递给处理程序,并使用它将消息发送到UI Thread 。 这里可以找到一个很好的例子。 您还可以使用本地BroadcastReceiver 。 您只需定义要处理数据的接收器(因此,UI线程),然后在此处处理您想要的任何内容。 这是一个很好的例子。 后者基于Inte ...
  • 我认为你可以做的是,在doInBackground()你需要调用publishProgress() ,这将导致onProgrssUpdate()的回调,在onProgressUpdate() ,你可以使onProgrssUpdate()不可见并使下一个imageView可见。 I think what you can do is, in doInBackground() you need to call publishProgress() that will result in a callback to ...
  • 像这样传递活动上下文 alertDialog = new AlertDialog.Builder(YourActivityName.this).create(); 如果要传递应用程序上下文,请为您的应用程序使用app comapact主题。 这是在styles.xml文件中明确定义的 但是你需要在onProgressUpdate()方法中显示对话框。 你不需要运行ui线程。 当异步任务已经有一个方法来显示ui上的一些输出。 pass activity context here like this aler ...
  • 只要我记得它,Swing在显示窗口时有“延迟”,这可能与操作系统实现的帧之间的时间以及本机消息和事件队列的连接有关,但这是纯粹的观察 我带了你的代码,只需将框架的创建包装到EventQueue.invokeLater就能得到类似的行为 根据系统和配置的不同,您将在不同的系统上获得不同的结果 导致窗口在第一次传递中呈现的事件是什么? 我所做的就是拿你的代码并将创建包装在EventQueue.invokeLater ,例如...... import java.awt.Dimension; import java ...
  • UIThread是您的应用程序的主要执行线程。 这是您的大多数应用程序代码运行的地方。 在此线程中创建了所有应用程序组件(活动,服务,ContentProvider,BroadcastReceivers),并且在此线程中执行对这些组件的任何系统调用。 例如,假设你的应用程序是一个Activity类。 那么所有的生命周期方法和大部分的事件处理代码都在这个UIThread中运行。 这些是诸如onCreate , onPause , onDestroy , onClick等的方法。此外,这是UI的所有更新。 任何 ...
  • 加break; 到你的if语句,所以循环停止评估。 否则,只有最后一个结果才会更新HTML。 Add break; to your if statement, so the loop stops evaluating. Otherwise, only the last result will update the HTML.
  • 没有回调方法来处理这个问题。 但是你可以通过在@Background注释方法的开头和结尾处调用方法来获得相同的结果(你说@UIThread但我希望这是一个错误:))。 示例: @Background void longRunningProcess() { longRunningProcessStarted(); //... longRunningProcessEnded(); } @UiThread void longRunningProcessStarted() { } @U ...
  • 你可以像这样转换它: @Click void button1(View view) { startProcess(); } void startProcess() { if(progressBar !=null) // progressBar should be a field in your Activity / Fragment progressBar.setVisibility(ProgressBar.VISIBLE); button1.setEnabled(false) ...
  • 一个很好的方法是使用内置的Looper类。 Looper是支持Android UI线程的消息排队系统,您也可以将它与自己的线程一起使用。 它的设计方式有什么好处,它创建了非常少的垃圾收集负载(取决于你使用的参数类型,它可以是无)。 我正在写这个写意,所以你不得不破解它以使它工作,但这里最终看起来像: class LooperThread extends Thread { private static final int MSG_TYPE_OUTPUT_DATA = 0; private Ha ...
  • 我听说RunOnUiThread方法将一个runnable ( RunOnUiThread的{}块)发布到UI线程的handler 。 然后UI线程将在不忙时执行runnable.run()方法。 如你所知,UI 必须有一段时间让我们不忙,因为如果没有,它会导致系统显示ANR(应用程序没有响应)消息(甚至当UI线程尝试运行耗时时它会抛出Exception (滞后)工作,如网络:))。 ** edit **这是一个java代码,向您展示runOnUiThread工作原理。 引自此博客(韩文) @Overrid ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)