ThreadPool Executor不在GAE中执行线程(ThreadPool Executor not executing threads in GAE)
我正在尝试在Google App引擎中使用执行程序框架。 Bellow是我试图运行的代码。
Thread thread = ThreadManager.createBackgroundThread(new Runnable(){ public void run(){ try{ LOGGER.info( "Checking background thread"); Thread.sleep(10); } catch (InterruptedException ex){ throw new RuntimeException("Exception:", ex); } } }); ScheduledThreadPoolExecutor executor = (ScheduledThreadPoolExecutor) Executors.newScheduledThreadPool(10, ThreadManager.backgroundThreadFactory()); executor.scheduleAtFixedRate(thread, 0, 30, TimeUnit.MINUTES);
但这并没有启动线程。 但是如果我使用thread.start()它可以正常工作。 我检查过Whitelisted Classes ,它确实提供了Executor类。 那我在做错了什么?
I am trying to use executor framework in Google App engine. Bellow is the code that I am trying to run.
Thread thread = ThreadManager.createBackgroundThread(new Runnable(){ public void run(){ try{ LOGGER.info( "Checking background thread"); Thread.sleep(10); } catch (InterruptedException ex){ throw new RuntimeException("Exception:", ex); } } }); ScheduledThreadPoolExecutor executor = (ScheduledThreadPoolExecutor) Executors.newScheduledThreadPool(10, ThreadManager.backgroundThreadFactory()); executor.scheduleAtFixedRate(thread, 0, 30, TimeUnit.MINUTES);
But this doesn't start the thread. But if I use thread.start() it works properly. I have checked Whitelisted Classes and it does provide Executor classes. So where I am doing it wrong ?
原文:https://stackoverflow.com/questions/29209522
更新时间:2023-01-27 22:01
最满意答案
我假设你在参数中发送一个整数,并将其作为字符串传递
function validatePhone(number) { var re = /^09[0-9]{9}$/; return re.test(number); } alert(validatePhone('09123456789')); // returns true alert(validatePhone(09123456789)); // returns false
I am assuming you are sending an integer in the argument, pass it as a string
function validatePhone(number) { var re = /^09[0-9]{9}$/; return re.test(number); } alert(validatePhone('09123456789')); // returns true alert(validatePhone(09123456789)); // returns false
相关问答
更多-
我也有这个问题,并且发现这里没有重复的正则表达式号码,加+号是电话号码。 最后我自己格式化了这个正则表达式: Regex phonePattern = new Regex(@"\s*(?:\+?(\d{1,3}))?([-. (]*(\d{3})[-. )]*)?((\d{3})[-. ]*(\d{2,4})(?:[-.x ]*(\d+))?)\s*"); 在正则表达式101上看到它 这将匹配: +nnnnnnnnnn +nnn-nnn-nn nnnnnnnnnnn nnnn-nnnn-n (nnn)nn ...
-
String sPhoneNumber = "456-8889999"; Pattern pattern = Pattern.compile("\\([4-6]{1}[0-9]{2}\\) [0-9]{3}\\-[0-9]{4}$"); Matcher matcher = pattern.matcher(sPhoneNumber); if (matcher.matches()) { System.out.println("Phone Number Valid"); } ...
-
更好的选择...只需删除输入上的所有非数字字符(“x”和“+”符号除外),请注意,因为英国人倾向于以非标准形式+44 (0) ...编写数字+44 (0) ...当被要求使用国际前缀(在具体情况下,您应该完全丢弃(0) )。 那么你最终会得到如下值: 12345678901 12345678901x1234 345678901x1234 12344678901 12345678901 12345678901 12345678901 +4112345678 +441234567890 然后 ...
-
具体电话号码正则表达式(Specific phone number regex)[2023-03-26]
这个正则表达式应该对你有用; /^\([0-9]{2}\)[ ][0-9]{4,5}\-[0-9]{4}$/ http://regex101.com/r/yQ2iV5/2 This regular expression should be of use to you; /^\([0-9]{2}\)[ ][0-9]{4,5}\-[0-9]{4}$/ http://regex101.com/r/yQ2iV5/2 -
我假设你在参数中发送一个整数,并将其作为字符串传递 function validatePhone(number) { var re = /^09[0-9]{9}$/; return re.test(number); } alert(validatePhone('09123456789')); // returns true alert(validatePhone(09123456789)); // returns false http://jsfiddl ...
-
要验证整个字符串处理由逗号分隔的多个值,只需添加一个带*乘数的组: ^\+\d{8,11}(,\+\d{8,11})*$ To validate the whole string handling mulitple values sepparated by comma just add an group with * multiplier: ^\+\d{8,11}(,\+\d{8,11})*$
-
正则表达式的电话号码(Regex phone number)[2024-03-16]
电话号码的正则表达式是 \b(0?\d\d)?[2345]\d{7}\b 手机号码的正则表达式是 \b(0?\d\d)?9[678]\d{7}\b 用于同时验证它们的正则表达式是 \b(0?\d\d)?([2345]|9[678])\d{7}\b 见演示: 1,2,3 。 \d escaper根据您的语言而有效。 如果不起作用,请尝试用[0-9]替换它。 The regex for the phone number is \b(0?\d\d)?[2345]\d{7}\b The regex for ... -
正则表达式验证电话号码(regex to validate phone number)[2022-02-11]
^\+?(\d[.\- ]*){9,14}(e?xt?\d{1,5})?$ 说明; ^断言字符串的开头 \+? 匹配可选加号 (\d[.\- ]*){9,14}介于9到14个单位数之间,可能用空格,圆点或短划线分隔。 (e?xt?\d{1,5})? 可选地,ax可能先于e或后跟t。 这些字母后面跟着1到5个数字。 $ Asserts字符串的结尾 ^\+?(\d[.\- ]*){9,14}(e?xt?\d{1,5})?$ Explanation; ^ Asserts start of string \+? ... -
使用javascript和regex [复制]验证电话号码(Validate phone number with javascript and regex [duplicate])[2022-05-31]
看起来你是允许数字空格和超量。 为什么不删除空格和连字符,并检查其余部分是否为数字。 var str = "123 321 123"; str = str.replace( /\s|-/g, "" ); 现在运行自己的正则表达式 "123 321 123".replace( /\s|-/g, "" ).match(/^[0-9\+]{8,13}$/) 或者只是在正则表达式中包含空格和连字符 "123 321 123".match(/^[0-9\+\s-]{8,13}$/); Looks like yo ...