如何使用OpenLDAP API选择LDAP客户端绑定的地址?(How do you select which address the LDAP client binds to using OpenLDAP API?)
有没有办法使用OpenLDAP API在多宿主机器上的LDAP客户端上设置用于套接字绑定的特定网络接口地址; 就像使用Microsoft的LDAP客户端使用LDAP_OPT_SOCKET_BIND_ADDRESSES选项一样。
Is there a way using the OpenLDAP API to set a particular network interface address to be used for socket bind on the LDAP client on a multi homed machine; like you do with the LDAP_OPT_SOCKET_BIND_ADDRESSES option with Microsoft's LDAP client.
原文:https://stackoverflow.com/questions/26047690
最满意答案
我们不提供这样的API,因为它可能导致误用。 例如检查一份工作是否存在以决定是否添加(因为这是竞争条件的处方)。
如果你真的需要这个,你可以覆盖持久队列并提供你自己的队列,在那里你可以追踪工作增加/删除。 有关详细信息,请参阅JobManager配置WIKI:
https://github.com/yigit/android-priority-jobqueue/wiki/Job-Manager-Configuration
编辑:一个示例竞赛条件
有人可能会写这样的代码:
if (!jobManager.hasJobOfType(ImportantJob.class)) { jobManager.addJob(new ImportantJob()); } else { // it is already added, no need to re add }
这里
hasJobOfType
返回true,但同时Job将要被取消。 现在,没有工作要运行:/。 另一种竞争条件是,代码可能在其他地方调用了addJobInBackground
因此它将被添加,但它在hasJobOfType
调用时尚未添加。这种情况下的最佳解决方案是在onCancel中重新创建另一项工作,或手动处理onRun方法中的以前作业的取消(使用全局计数器等)。 另一个选择是使用其回调版本的
cancelAsync
方法。http://yigit.github.io/android-priority-jobqueue/javadoc/index.html
We don't provide such an API because it may lead to mis-uses. e.g. checking a job if it exists to decide whether to add or not (because that is recipe for race conditions).
If you really need this, you can override the persistent queue and provide your own queue where you can track job additions/removals. See the JobManager configuration WIKI for details:
https://github.com/yigit/android-priority-jobqueue/wiki/Job-Manager-Configuration
edit: An example race condition
Someone may write a code like this:
if (!jobManager.hasJobOfType(ImportantJob.class)) { jobManager.addJob(new ImportantJob()); } else { // it is already added, no need to re add }
There is a potential race condition here where
hasJobOfType
returns true but meanwhile Job is about to be canceled. Now, there is no job to run :/. Another race condition is, somewhere else the code might have calledaddJobInBackground
so it will be added but it is not yet added at the time of thehasJobOfType
call.The best solution for this kind of cases is to re-create another job in
onCancel
or manually handling the cancelation of previous jobs in onRun method (with a global counter etc). Another option is to usecancelAsync
method with its callback version.http://yigit.github.io/android-priority-jobqueue/javadoc/index.html
相关问答
更多-
看了一些源代码,我想你需要的: 还有一件事你应该注意:正在运行的作业的数量等于rq worker的数量。 因为工人一次只能处理一份工作。 from rq import Queue from redis import Redis from rq.registry import StartedJobRegistry from jobs import count_words_at_url redis_conn = Redis() q = Queue('default', connection=redis_c ...
-
为什么不直接给这些即时调用优先级并使用priority-job-queue运行它们呢? Why not just give those instant calls a higher priority and run them using priority-job-queue as well?
-
这基本上是在yarn api上通过elapsedTime获取应用程序的变体 。 在你的情况下,你可以使用RM Cluster Applications API来获取所有的应用程序(不幸的是它不会过滤name ),然后过滤名称等于distcp的应用程序。 以下显示了如何使用jq进行过滤: $ curl 'RMURL/ws/v1/cluster/apps' | jq '.apps.app[] | select (.name == "distcp")' 对于您的情况,如果您只对活动作业感兴趣,则可以将state ...
-
考虑在/ var / log / syslog中检查日志中的cron 还请确保您可以实际写入文件/目录(chmod权限)。 进一步确保crontab userlevel也可以写入文件/目录。 我只是尝试了你的文件,它确实对我来说执行得很好,会尝试以与你相同的方式将其作为crontab int。 编辑:把它作为一个cronjob,并运作良好,不知道是什么问题! Apparently crond wasn't running.... #service crond restart Stopping crond: ...
-
实际上,你无法获得当前Keyboard.Detail的引用(请记得阅读评论。)。 I try get height of virtual keyboard Android like this [Is there any way in android to get the height of virtual keyboard of device But I do not get heigth - only get heigth of screen. (I make android plugin for Uni ...
-
在android-priority-jobqueue中检索活动作业的当前列表(Retrieve current list of active jobs in android-priority-jobqueue)[2022-07-30]
我们不提供这样的API,因为它可能导致误用。 例如检查一份工作是否存在以决定是否添加(因为这是竞争条件的处方)。 如果你真的需要这个,你可以覆盖持久队列并提供你自己的队列,在那里你可以追踪工作增加/删除。 有关详细信息,请参阅JobManager配置WIKI: https://github.com/yigit/android-priority-jobqueue/wiki/Job-Manager-Configuration 编辑:一个示例竞赛条件 有人可能会写这样的代码: if (!jobManager.ha ... -
取决于你的数据库结构,你可以这样做 SELECT * FROM jobs WHERE active = 1 AND closingdate >= NOW() depending on your database structure, you could do SELECT * FROM jobs WHERE active = 1 AND closingdate >= NOW()
-
注意:尝试从uri获取文件名是错误的。 不要这样做! 内容提供商还可以共享任何文件中不存在的任意数据,或者文件名可能会产生误导。 例如content://downloads/some_secret_data可能指向不在downloads文件夹中的文件。 所以最好的办法是立即从内容提供商处读取/复制数据,然后使用该数据做任何你想做的事情。 就我而言,我上传了它。 以前的错误答案(不要这样做!): 这就是我所做的,对我来说工作正常。 如果有人有更好的解决方案,请分享。 我有android.permission. ...
-
您的服务器将向您推送联系人的状态信息:可用状态 - >用户上线。 存在不可用 - >用户离线。 当您第一次连接并启动会话时,服务器将向您发送在线联系人的所有状态。 从那时起,只要您的某个联系人更改其状态,您就会收到在线状态。 所以你总是更新。 客户有责任(就是你)根据这一点保持联系人列表的当前状态。 imho,没有标准的方法来查询服务器中的活动成员。 也许有些服务器实现了这个功能,不知道。 Your server will push to you presence information from your ...
-
我猜你在旋转时重新创造了这个工作,那么你最终得到了2个工作。 当活动更改配置(也称为旋转)时,您不应将其排队两次。 I'm guessing you are re-creating the job when you rotate so then you end up with 2 jobs. You should not enqueue it twice when activity changes configuration (a.k.a. rotation).