ScheduledExecutorService task will be executed by multi-thread










0














This makes me really curious.There is a button which sends a simple post request by ajax on a jsp page,and I use a RESTFUL method to handle this request,but that method will be executed twice or three times.This will only happen on CentOS 7.3,on my laptop I use windows10, multi-thread will not happen.I have searched on Google but nothing helpful
has been found.Here are the codes:




asset.jsp:




<button class="btn btn-default btn-sm" title="allDoMi">
<i class="fa fa-arrow-down">allDoMi</i>
</button>
$("button[title='allDoMi']").click(function ()
var dataparam = "version=1";
if (!confirm('confirm all DoMi?'))
return;
//ajax request
$.ajax(
contentType: "application/json",
url: serviceurl.baseurl + "/asset/doMiAction",
data: dataparam,
beforeSend: function ()
//do nothing
,
error: function ()
//do nothing
,
success: function (info)
//do nothing

);
);



Asset.java




@Service
@Path("/asset")
public class AssetRest {
@Path("/doMiAction")
@POST
@Produces( MediaType.APPLICATION_JSON,
MediaType.APPLICATION_XML )
public RestfulResult doMiAction(@FormParam("version") String
version)
logger.info("doMiAction method began....");
//package data for duMiSyncDtos,here only for test
List<DuMiSyncDto> duMiSyncDtos =new List<>();
//this url is for http simulation using HttpURLConnection
final String dumiUrl = "http://someip/someurl";
final Map<String, List<DuMiSyncDto>> map;
//only continue when list is not empty
if (!duMiSyncDtos.isEmpty())
//this method used for sync data in a certain order
map = groupList(duMiSyncDtos);
SortedSet<String> ss = new TreeSet<>(map.keySet());
final Iterator<String> iter = ss.iterator();
final ScheduledExecutorService ticker = Executors.newSingleThreadScheduledExecutor();
logger.info("NEW A SINGLETHREADSCHEDULEDEXECUTOR");
//retrieve data from a .property file,I set it 20000,therefore the job will be executed in every 20 seconds
final int DELAY = NumberUtils.toInt(WebUtils.getConfigValue("dumi.delay"));
ticker.scheduleWithFixedDelay(new Runnable()
private int count;
public void run()
logger.info("BEGIN RUN METHOD:"+System.identityHashCode(AssetRest.this));
if(iter.hasNext())
try
List<DuMiSyncDto> value = map.get(iter.next());
//this method used for simulating a httprequest using HttpURLConnection to invoke a remote service to get the result info which forms in a JSON string format
String resultmsg = getDuMiReturnMessage(dumiUrl,value);
if(resultmsg!=null && !resultmsg.contains(""code":"0000""))
logger.info("Return code is "+resultmsg+",the sync work will be terminated.");
ticker.shutdown();
return;

//this method used for showing some useful infomation on the console using log4j
showSyncInfomation(value);
//this method used for count how many items have been synchronized successfully
int currentcount = getSyncCount(resultmsg);
count += currentcount ;
logger.info("current sync data:"+currentcount+",summing data"+count+"");
catch (Exception e)
logger.error("method[doMiAction]...executing schedule:",e);

else
ticker.shutdown();


, 0, DELAY, TimeUnit.MILLISECONDS);




After I click the button,all the log info will be shown on Putty console for two or three times,yet I have clicked that button for only ONCE!I have tested for several times,it will happen,but in windows on my laptop,this will not happen at all.Here is a detail might be help:previously the implementation for timed execution is not like this,it has been written like :



for(DuMiSyncDto dto:duMiSyncDtoList)
//do the business code
Thread.sleep(20000);



Because there is database synchronization from the remote service,I need to control the interval time not too soon between every two operations:execute in every 20 seconds and 100 data at a time.In this situation,the multi-thread problem occurs,I thought it may be the for loop which aroused so I change the way using a JDK API instead but issues were still there.So WHY all of these?



---------------------------first edit------------------------------------------



private int getSyncCount(String resultmsg) 
int count = 0;
JSONObject obj = JSONObject.fromObject(resultmsg);
String message = obj.getString("message");
if(!WebUtils.isEmpty(message))
String arr = message.split(" ");
if(arr!=null && arr.length>1)
count += Integer.parseInt(arr[1].trim());


logger.info("currentThreadName:"+Thread.currentThread().getName());
return count;



Notice in this method,I log the current thread name,and it shows :



... 
currentThreadName:pool-1-thread-1
currentThreadName:pool-2-thread-1
currentThreadName:pool-3-thread-1
...


when there are 3 threads.










share|improve this question























  • Is the log statement "doMiAction method began...." appearing more than once even when you click the button once? If yes, then the issue might be elsewhere rather than code. If not, can you tell on one click what all log statements are appearing on console?
    – Bandi Kishore
    Nov 13 '18 at 3:44










  • Yes,all the info in logger.info method will appear more than once,it seems somebody else clicks that button ,but none in fact,and I only click it once indeed.Please see my first edit for more details.
    – Eric Ben
    Nov 13 '18 at 5:26











  • Can you try to inspect the number of calls from browser when you try the click? Also, can you try a curl request with post from the machine and see if multiple requests are being made. Just to eliminate there is no issue with the browser or mouse :)
    – Bandi Kishore
    Nov 13 '18 at 5:45










  • Same environment at my laptop with Windows10,nothing weird happened.
    – Eric Ben
    Nov 13 '18 at 5:51










  • I agree. But again its to check whether issue is with the code or the environment. If you run the curl command from with in that CentOS box and it results in just one request, then maybe the issue is somewhere in the gateway or proxy in middle.
    – Bandi Kishore
    Nov 13 '18 at 6:23















0














This makes me really curious.There is a button which sends a simple post request by ajax on a jsp page,and I use a RESTFUL method to handle this request,but that method will be executed twice or three times.This will only happen on CentOS 7.3,on my laptop I use windows10, multi-thread will not happen.I have searched on Google but nothing helpful
has been found.Here are the codes:




asset.jsp:




<button class="btn btn-default btn-sm" title="allDoMi">
<i class="fa fa-arrow-down">allDoMi</i>
</button>
$("button[title='allDoMi']").click(function ()
var dataparam = "version=1";
if (!confirm('confirm all DoMi?'))
return;
//ajax request
$.ajax(
contentType: "application/json",
url: serviceurl.baseurl + "/asset/doMiAction",
data: dataparam,
beforeSend: function ()
//do nothing
,
error: function ()
//do nothing
,
success: function (info)
//do nothing

);
);



Asset.java




@Service
@Path("/asset")
public class AssetRest {
@Path("/doMiAction")
@POST
@Produces( MediaType.APPLICATION_JSON,
MediaType.APPLICATION_XML )
public RestfulResult doMiAction(@FormParam("version") String
version)
logger.info("doMiAction method began....");
//package data for duMiSyncDtos,here only for test
List<DuMiSyncDto> duMiSyncDtos =new List<>();
//this url is for http simulation using HttpURLConnection
final String dumiUrl = "http://someip/someurl";
final Map<String, List<DuMiSyncDto>> map;
//only continue when list is not empty
if (!duMiSyncDtos.isEmpty())
//this method used for sync data in a certain order
map = groupList(duMiSyncDtos);
SortedSet<String> ss = new TreeSet<>(map.keySet());
final Iterator<String> iter = ss.iterator();
final ScheduledExecutorService ticker = Executors.newSingleThreadScheduledExecutor();
logger.info("NEW A SINGLETHREADSCHEDULEDEXECUTOR");
//retrieve data from a .property file,I set it 20000,therefore the job will be executed in every 20 seconds
final int DELAY = NumberUtils.toInt(WebUtils.getConfigValue("dumi.delay"));
ticker.scheduleWithFixedDelay(new Runnable()
private int count;
public void run()
logger.info("BEGIN RUN METHOD:"+System.identityHashCode(AssetRest.this));
if(iter.hasNext())
try
List<DuMiSyncDto> value = map.get(iter.next());
//this method used for simulating a httprequest using HttpURLConnection to invoke a remote service to get the result info which forms in a JSON string format
String resultmsg = getDuMiReturnMessage(dumiUrl,value);
if(resultmsg!=null && !resultmsg.contains(""code":"0000""))
logger.info("Return code is "+resultmsg+",the sync work will be terminated.");
ticker.shutdown();
return;

//this method used for showing some useful infomation on the console using log4j
showSyncInfomation(value);
//this method used for count how many items have been synchronized successfully
int currentcount = getSyncCount(resultmsg);
count += currentcount ;
logger.info("current sync data:"+currentcount+",summing data"+count+"");
catch (Exception e)
logger.error("method[doMiAction]...executing schedule:",e);

else
ticker.shutdown();


, 0, DELAY, TimeUnit.MILLISECONDS);




After I click the button,all the log info will be shown on Putty console for two or three times,yet I have clicked that button for only ONCE!I have tested for several times,it will happen,but in windows on my laptop,this will not happen at all.Here is a detail might be help:previously the implementation for timed execution is not like this,it has been written like :



for(DuMiSyncDto dto:duMiSyncDtoList)
//do the business code
Thread.sleep(20000);



Because there is database synchronization from the remote service,I need to control the interval time not too soon between every two operations:execute in every 20 seconds and 100 data at a time.In this situation,the multi-thread problem occurs,I thought it may be the for loop which aroused so I change the way using a JDK API instead but issues were still there.So WHY all of these?



---------------------------first edit------------------------------------------



private int getSyncCount(String resultmsg) 
int count = 0;
JSONObject obj = JSONObject.fromObject(resultmsg);
String message = obj.getString("message");
if(!WebUtils.isEmpty(message))
String arr = message.split(" ");
if(arr!=null && arr.length>1)
count += Integer.parseInt(arr[1].trim());


logger.info("currentThreadName:"+Thread.currentThread().getName());
return count;



Notice in this method,I log the current thread name,and it shows :



... 
currentThreadName:pool-1-thread-1
currentThreadName:pool-2-thread-1
currentThreadName:pool-3-thread-1
...


when there are 3 threads.










share|improve this question























  • Is the log statement "doMiAction method began...." appearing more than once even when you click the button once? If yes, then the issue might be elsewhere rather than code. If not, can you tell on one click what all log statements are appearing on console?
    – Bandi Kishore
    Nov 13 '18 at 3:44










  • Yes,all the info in logger.info method will appear more than once,it seems somebody else clicks that button ,but none in fact,and I only click it once indeed.Please see my first edit for more details.
    – Eric Ben
    Nov 13 '18 at 5:26











  • Can you try to inspect the number of calls from browser when you try the click? Also, can you try a curl request with post from the machine and see if multiple requests are being made. Just to eliminate there is no issue with the browser or mouse :)
    – Bandi Kishore
    Nov 13 '18 at 5:45










  • Same environment at my laptop with Windows10,nothing weird happened.
    – Eric Ben
    Nov 13 '18 at 5:51










  • I agree. But again its to check whether issue is with the code or the environment. If you run the curl command from with in that CentOS box and it results in just one request, then maybe the issue is somewhere in the gateway or proxy in middle.
    – Bandi Kishore
    Nov 13 '18 at 6:23













0












0








0







This makes me really curious.There is a button which sends a simple post request by ajax on a jsp page,and I use a RESTFUL method to handle this request,but that method will be executed twice or three times.This will only happen on CentOS 7.3,on my laptop I use windows10, multi-thread will not happen.I have searched on Google but nothing helpful
has been found.Here are the codes:




asset.jsp:




<button class="btn btn-default btn-sm" title="allDoMi">
<i class="fa fa-arrow-down">allDoMi</i>
</button>
$("button[title='allDoMi']").click(function ()
var dataparam = "version=1";
if (!confirm('confirm all DoMi?'))
return;
//ajax request
$.ajax(
contentType: "application/json",
url: serviceurl.baseurl + "/asset/doMiAction",
data: dataparam,
beforeSend: function ()
//do nothing
,
error: function ()
//do nothing
,
success: function (info)
//do nothing

);
);



Asset.java




@Service
@Path("/asset")
public class AssetRest {
@Path("/doMiAction")
@POST
@Produces( MediaType.APPLICATION_JSON,
MediaType.APPLICATION_XML )
public RestfulResult doMiAction(@FormParam("version") String
version)
logger.info("doMiAction method began....");
//package data for duMiSyncDtos,here only for test
List<DuMiSyncDto> duMiSyncDtos =new List<>();
//this url is for http simulation using HttpURLConnection
final String dumiUrl = "http://someip/someurl";
final Map<String, List<DuMiSyncDto>> map;
//only continue when list is not empty
if (!duMiSyncDtos.isEmpty())
//this method used for sync data in a certain order
map = groupList(duMiSyncDtos);
SortedSet<String> ss = new TreeSet<>(map.keySet());
final Iterator<String> iter = ss.iterator();
final ScheduledExecutorService ticker = Executors.newSingleThreadScheduledExecutor();
logger.info("NEW A SINGLETHREADSCHEDULEDEXECUTOR");
//retrieve data from a .property file,I set it 20000,therefore the job will be executed in every 20 seconds
final int DELAY = NumberUtils.toInt(WebUtils.getConfigValue("dumi.delay"));
ticker.scheduleWithFixedDelay(new Runnable()
private int count;
public void run()
logger.info("BEGIN RUN METHOD:"+System.identityHashCode(AssetRest.this));
if(iter.hasNext())
try
List<DuMiSyncDto> value = map.get(iter.next());
//this method used for simulating a httprequest using HttpURLConnection to invoke a remote service to get the result info which forms in a JSON string format
String resultmsg = getDuMiReturnMessage(dumiUrl,value);
if(resultmsg!=null && !resultmsg.contains(""code":"0000""))
logger.info("Return code is "+resultmsg+",the sync work will be terminated.");
ticker.shutdown();
return;

//this method used for showing some useful infomation on the console using log4j
showSyncInfomation(value);
//this method used for count how many items have been synchronized successfully
int currentcount = getSyncCount(resultmsg);
count += currentcount ;
logger.info("current sync data:"+currentcount+",summing data"+count+"");
catch (Exception e)
logger.error("method[doMiAction]...executing schedule:",e);

else
ticker.shutdown();


, 0, DELAY, TimeUnit.MILLISECONDS);




After I click the button,all the log info will be shown on Putty console for two or three times,yet I have clicked that button for only ONCE!I have tested for several times,it will happen,but in windows on my laptop,this will not happen at all.Here is a detail might be help:previously the implementation for timed execution is not like this,it has been written like :



for(DuMiSyncDto dto:duMiSyncDtoList)
//do the business code
Thread.sleep(20000);



Because there is database synchronization from the remote service,I need to control the interval time not too soon between every two operations:execute in every 20 seconds and 100 data at a time.In this situation,the multi-thread problem occurs,I thought it may be the for loop which aroused so I change the way using a JDK API instead but issues were still there.So WHY all of these?



---------------------------first edit------------------------------------------



private int getSyncCount(String resultmsg) 
int count = 0;
JSONObject obj = JSONObject.fromObject(resultmsg);
String message = obj.getString("message");
if(!WebUtils.isEmpty(message))
String arr = message.split(" ");
if(arr!=null && arr.length>1)
count += Integer.parseInt(arr[1].trim());


logger.info("currentThreadName:"+Thread.currentThread().getName());
return count;



Notice in this method,I log the current thread name,and it shows :



... 
currentThreadName:pool-1-thread-1
currentThreadName:pool-2-thread-1
currentThreadName:pool-3-thread-1
...


when there are 3 threads.










share|improve this question















This makes me really curious.There is a button which sends a simple post request by ajax on a jsp page,and I use a RESTFUL method to handle this request,but that method will be executed twice or three times.This will only happen on CentOS 7.3,on my laptop I use windows10, multi-thread will not happen.I have searched on Google but nothing helpful
has been found.Here are the codes:




asset.jsp:




<button class="btn btn-default btn-sm" title="allDoMi">
<i class="fa fa-arrow-down">allDoMi</i>
</button>
$("button[title='allDoMi']").click(function ()
var dataparam = "version=1";
if (!confirm('confirm all DoMi?'))
return;
//ajax request
$.ajax(
contentType: "application/json",
url: serviceurl.baseurl + "/asset/doMiAction",
data: dataparam,
beforeSend: function ()
//do nothing
,
error: function ()
//do nothing
,
success: function (info)
//do nothing

);
);



Asset.java




@Service
@Path("/asset")
public class AssetRest {
@Path("/doMiAction")
@POST
@Produces( MediaType.APPLICATION_JSON,
MediaType.APPLICATION_XML )
public RestfulResult doMiAction(@FormParam("version") String
version)
logger.info("doMiAction method began....");
//package data for duMiSyncDtos,here only for test
List<DuMiSyncDto> duMiSyncDtos =new List<>();
//this url is for http simulation using HttpURLConnection
final String dumiUrl = "http://someip/someurl";
final Map<String, List<DuMiSyncDto>> map;
//only continue when list is not empty
if (!duMiSyncDtos.isEmpty())
//this method used for sync data in a certain order
map = groupList(duMiSyncDtos);
SortedSet<String> ss = new TreeSet<>(map.keySet());
final Iterator<String> iter = ss.iterator();
final ScheduledExecutorService ticker = Executors.newSingleThreadScheduledExecutor();
logger.info("NEW A SINGLETHREADSCHEDULEDEXECUTOR");
//retrieve data from a .property file,I set it 20000,therefore the job will be executed in every 20 seconds
final int DELAY = NumberUtils.toInt(WebUtils.getConfigValue("dumi.delay"));
ticker.scheduleWithFixedDelay(new Runnable()
private int count;
public void run()
logger.info("BEGIN RUN METHOD:"+System.identityHashCode(AssetRest.this));
if(iter.hasNext())
try
List<DuMiSyncDto> value = map.get(iter.next());
//this method used for simulating a httprequest using HttpURLConnection to invoke a remote service to get the result info which forms in a JSON string format
String resultmsg = getDuMiReturnMessage(dumiUrl,value);
if(resultmsg!=null && !resultmsg.contains(""code":"0000""))
logger.info("Return code is "+resultmsg+",the sync work will be terminated.");
ticker.shutdown();
return;

//this method used for showing some useful infomation on the console using log4j
showSyncInfomation(value);
//this method used for count how many items have been synchronized successfully
int currentcount = getSyncCount(resultmsg);
count += currentcount ;
logger.info("current sync data:"+currentcount+",summing data"+count+"");
catch (Exception e)
logger.error("method[doMiAction]...executing schedule:",e);

else
ticker.shutdown();


, 0, DELAY, TimeUnit.MILLISECONDS);




After I click the button,all the log info will be shown on Putty console for two or three times,yet I have clicked that button for only ONCE!I have tested for several times,it will happen,but in windows on my laptop,this will not happen at all.Here is a detail might be help:previously the implementation for timed execution is not like this,it has been written like :



for(DuMiSyncDto dto:duMiSyncDtoList)
//do the business code
Thread.sleep(20000);



Because there is database synchronization from the remote service,I need to control the interval time not too soon between every two operations:execute in every 20 seconds and 100 data at a time.In this situation,the multi-thread problem occurs,I thought it may be the for loop which aroused so I change the way using a JDK API instead but issues were still there.So WHY all of these?



---------------------------first edit------------------------------------------



private int getSyncCount(String resultmsg) 
int count = 0;
JSONObject obj = JSONObject.fromObject(resultmsg);
String message = obj.getString("message");
if(!WebUtils.isEmpty(message))
String arr = message.split(" ");
if(arr!=null && arr.length>1)
count += Integer.parseInt(arr[1].trim());


logger.info("currentThreadName:"+Thread.currentThread().getName());
return count;



Notice in this method,I log the current thread name,and it shows :



... 
currentThreadName:pool-1-thread-1
currentThreadName:pool-2-thread-1
currentThreadName:pool-3-thread-1
...


when there are 3 threads.







java spring multithreading rest scheduledexecutorservice






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 13 '18 at 5:18







Eric Ben

















asked Nov 13 '18 at 2:59









Eric BenEric Ben

95




95











  • Is the log statement "doMiAction method began...." appearing more than once even when you click the button once? If yes, then the issue might be elsewhere rather than code. If not, can you tell on one click what all log statements are appearing on console?
    – Bandi Kishore
    Nov 13 '18 at 3:44










  • Yes,all the info in logger.info method will appear more than once,it seems somebody else clicks that button ,but none in fact,and I only click it once indeed.Please see my first edit for more details.
    – Eric Ben
    Nov 13 '18 at 5:26











  • Can you try to inspect the number of calls from browser when you try the click? Also, can you try a curl request with post from the machine and see if multiple requests are being made. Just to eliminate there is no issue with the browser or mouse :)
    – Bandi Kishore
    Nov 13 '18 at 5:45










  • Same environment at my laptop with Windows10,nothing weird happened.
    – Eric Ben
    Nov 13 '18 at 5:51










  • I agree. But again its to check whether issue is with the code or the environment. If you run the curl command from with in that CentOS box and it results in just one request, then maybe the issue is somewhere in the gateway or proxy in middle.
    – Bandi Kishore
    Nov 13 '18 at 6:23
















  • Is the log statement "doMiAction method began...." appearing more than once even when you click the button once? If yes, then the issue might be elsewhere rather than code. If not, can you tell on one click what all log statements are appearing on console?
    – Bandi Kishore
    Nov 13 '18 at 3:44










  • Yes,all the info in logger.info method will appear more than once,it seems somebody else clicks that button ,but none in fact,and I only click it once indeed.Please see my first edit for more details.
    – Eric Ben
    Nov 13 '18 at 5:26











  • Can you try to inspect the number of calls from browser when you try the click? Also, can you try a curl request with post from the machine and see if multiple requests are being made. Just to eliminate there is no issue with the browser or mouse :)
    – Bandi Kishore
    Nov 13 '18 at 5:45










  • Same environment at my laptop with Windows10,nothing weird happened.
    – Eric Ben
    Nov 13 '18 at 5:51










  • I agree. But again its to check whether issue is with the code or the environment. If you run the curl command from with in that CentOS box and it results in just one request, then maybe the issue is somewhere in the gateway or proxy in middle.
    – Bandi Kishore
    Nov 13 '18 at 6:23















Is the log statement "doMiAction method began...." appearing more than once even when you click the button once? If yes, then the issue might be elsewhere rather than code. If not, can you tell on one click what all log statements are appearing on console?
– Bandi Kishore
Nov 13 '18 at 3:44




Is the log statement "doMiAction method began...." appearing more than once even when you click the button once? If yes, then the issue might be elsewhere rather than code. If not, can you tell on one click what all log statements are appearing on console?
– Bandi Kishore
Nov 13 '18 at 3:44












Yes,all the info in logger.info method will appear more than once,it seems somebody else clicks that button ,but none in fact,and I only click it once indeed.Please see my first edit for more details.
– Eric Ben
Nov 13 '18 at 5:26





Yes,all the info in logger.info method will appear more than once,it seems somebody else clicks that button ,but none in fact,and I only click it once indeed.Please see my first edit for more details.
– Eric Ben
Nov 13 '18 at 5:26













Can you try to inspect the number of calls from browser when you try the click? Also, can you try a curl request with post from the machine and see if multiple requests are being made. Just to eliminate there is no issue with the browser or mouse :)
– Bandi Kishore
Nov 13 '18 at 5:45




Can you try to inspect the number of calls from browser when you try the click? Also, can you try a curl request with post from the machine and see if multiple requests are being made. Just to eliminate there is no issue with the browser or mouse :)
– Bandi Kishore
Nov 13 '18 at 5:45












Same environment at my laptop with Windows10,nothing weird happened.
– Eric Ben
Nov 13 '18 at 5:51




Same environment at my laptop with Windows10,nothing weird happened.
– Eric Ben
Nov 13 '18 at 5:51












I agree. But again its to check whether issue is with the code or the environment. If you run the curl command from with in that CentOS box and it results in just one request, then maybe the issue is somewhere in the gateway or proxy in middle.
– Bandi Kishore
Nov 13 '18 at 6:23




I agree. But again its to check whether issue is with the code or the environment. If you run the curl command from with in that CentOS box and it results in just one request, then maybe the issue is somewhere in the gateway or proxy in middle.
– Bandi Kishore
Nov 13 '18 at 6:23












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53273149%2fscheduledexecutorservice-task-will-be-executed-by-multi-thread%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53273149%2fscheduledexecutorservice-task-will-be-executed-by-multi-thread%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3

Museum of Modern and Contemporary Art of Trento and Rovereto