How to run multiple Thread using Scheduler's in 1.5
Hi,
I have a scenario, in which I have to run a Thread at every 15 minutes, If the first Thread is not Finished in 15 min then new Thread has to start.
Currently I implemeted with java 1.5 schedulers, but the problem is if my first Thread is taking more than 15 min, then no new Thread is starting.
Following is my Code:
TestAccountingThread accountingThread = new TestAccountingThread();
ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(10);
scheduler.scheduleAtFixedRate( accountingThread, 0, 60, SECONDS );
Can any one help on this, This is really urgent.
Regards,
Suman
if my first Thread is taking more than 15 min, then no new Thread is startingIf it takes more than 15 min, manually run a new scheduler with initial-delay=0 and shutdown the current one when the current execution is finished --- and repeat this logic in a conditional loop.
Could this be what you want?
Similar Messages
-
How to run multiple motors using NI 9501 in parallel
I want to run three motors at the same time using NI 9501 c series module and compac rio 9074 with the in built example of open loop velocity control..
what all I need to change in code...I actually copied the same fpga code and change the module setting..motors are working but for motor 2 when i try to disable its drive it disables motor 1..do I need to change something in RT code too??
Solved!
Go to Solution.Hi SaraBaber,
Thanks for posting. You will need to modify both the FPGA code and the Real Time code. In the FPGA code you should copy the contents of the drive status loop another 2 times (It is not necessary to make another 2 while loops, simply make the while loop bigger to include the extra code) and changing the modules to modules 2 and 3. Similiarly for the RT code, you can copy the existing code another 2 times wiring the extra two paths to the same 'Open FPGA VI Reference' and 'Close FPGA VI Reference'. You will also have to update the Read/Write controls for the second and third motor.
I hope this helps!
Paul
Applications Engineer
NI UK
I accept Kudos and BTC Tips :-D
Address: 1NyXnWf9kdjVzjWcW5w4P1V3b1EY4yXP12 -
Help with running multiple threads
I'm new to programming with threads. I want to know how to run
multiple threads at the same time. Particularly for making games
in Java which I'm also begining to learn. For running multiple
threads at the same time, do you have to put two run() methods
in the source? If not then how do you make two threads or more
run at the same time?
Thanks for helping.For running multiple
threads at the same time, do you have to put two run()
methods
in the source? Hi there,
Each thread is presumably performing a task. You may be performing the same task multiple times or be performing different tasks at once. Either way, each task would typically be contained within the run() method of a class. This class would either be a subclass of java.lang.Thread (extends Thread) or would be an implementation of java.lang.Runnable (implements Runnable). In either case, you would define a method with signature (public void run()...). The difference comes into play when you wish to actually perform one of these tasks. With a subclass of Thread, you would simply perform:
new MyTask().start();
With an implementation of Runnable, you would do this:
new Thread(new MyTask()).start();
This assumes you don't need to monitor the threads, won't be sending any messages to your tasks or any such thing. If that were the case, you would need to tuck away those returns to new MyTask() for later access.
In order to launch two threads simultaneously, you would have something along the lines of:
new MyTask().start();
new MyOtherTask().start();
Now it is perfectly possible that MyTask() would complete before MyOtherTask() managed to start in which case it wouldn't appear as if you had actually had multiple threads running, but for non-trivial tasks, the two will likely overlap. And of course, in a game, these tasks would likely be launched in response to user input, which means that you wouldn't have any control over when or in what order they executed.
Anyhow, it's as simple as that. You should also consider following the Java Threading trail which shows a simple example of using multiple threads. You can find it at:
http://java.sun.com/docs/books/tutorial/essential/threads/index.html
Regards,
Lynn -
How to run the job using DBMS_SCHEDULER
How to run the job using DBMS_SCHEDULER
pleas give some sample Iam very new to DBMS_SCHEDULERHi
DBMS_SCHEDULER
In Oracle 10g the DBMS_JOB package is replaced by the DBMS_SCHEDULER package. The DBMS_JOB package is now depricated and in Oracle 10g it's only provided for backward compatibility. From Oracle 10g the DBMS_JOB package should not be used any more, because is could not exist in a future version of Oracle.
With DBMS_SCHEDULER Oracle procedures and functions can be executed. Also binary and shell-scripts can be scheduled.
Rights
If you have DBA rights you can do all the scheduling. For administering job scheduling you need the privileges belonging to the SCHEDULER_ADMIN role. To create and run jobs in your own schedule you need the 'CREATE JOB' privilege.
With DBMS_JOB you needed to set an initialization parameter to start a job coordinator background process. With Oracle 10g DBMS_SCHEDULER this is not needed any more.
If you want to user resource plans and/or consumer groups you need to set a system parameter:
ALTER SYSTEM SET RESOURCE_LIMIT = TRUE;
Baisc Parts: Job
A job instructs the scheduler to run a specific program at a specific time on a specific date.
Programs
A program contains the code (or reference to the code ) that needs to be run to accomplish a task. It also contains parameters that should be passed to the program at runtime. And it?s an independent object that can referenced by many jobs
Schedules
A schedule contains a start date, an optional end date, and repeat interval with these elements; an execution schedule can be calculated.
Windows
A window identifies a recurring block of time during which a specific resource plan should be enabled to govern resource allocation for the database.
Job groups
A job group is a logical method of classifying jobs with similar characteristics.
Window groups
A window groups is a logical method of grouping windows. They simplify the management of windows by allowing the members of the group to be manipulated as one object. Unlike job groups, window groups don?t set default characteristics for windows that belong to the group.
Using Job Scheduler
SQL> drop table emp;
SQL> Create table emp (eno int, esal int);
SQL > begin
dbms_scheduler.create_job (
job_name => 'test_abc',
job_type => 'PLSQL_BLOCK',
job_action => 'update emp set esal=esal*10 ;',
start_date => SYSDATE,
repeat_interval => 'FREQ=DAILY; INTERVAL=10',
comments => 'Iam tesing scheduler');
end;
PL/SQL procedure successfully completed.
Verification
To verify that job was created, the DBA | ALL | USER_SCHEDULER_JOBS view can be queried.
SQL> select job_name,enabled,run_count from user_scheduler_jobs;
JOB_NAME ENABL RUN_COUNT
TEST_abc FALSE 0
Note :
As you can see from the results, the job was indeed created, but is not enabled because the ENABLE attribute was not explicitly set in the CREATE_JOB procedure.
Run your job
SQL> begin
2 dbms_scheduler.run_job('TEST_abc',TRUE);
3* end;
SQL> /
PL/SQL procedure successfully completed.
SQL> select job_name,enabled,run_count from user_scheduler_jobs;
JOB_NAME ENABL RUN_COUNT
TEST_ABC FALSE 0
Copying Jobs
SQL> begin
2 dbms_scheduler.copy_job('TEST_ABC','NEW_TEST_ABC');
3 END;
4 /
PL/SQL procedure successfully completed. Hope it will help you upto some level..!!
Regards
K -
How to get multiple records using fn-bea:execute-sql()
Hi,
I created Proxy service(ALSB3.0) to get records from DB table. I have used Xquery function(fn-bea:execute-sql()). Using simple SQL query I got single record, but my table having multiple records. Please suggest how to get multiple records using fn-bea:execute-sql() and how to assign them in ALSB variable.
Regards,
Nagaraju
Edited by: user10373980 on Sep 29, 2008 6:11 AMHi,
Am facing the same issue stated above that I couldnt get all the records in the table that am querying in the Proxyservice.
For example:
fn-bea:execute-sql('EsbDataSource', 'student', 'select Name from StudentList' ) is the query that am using to fetch the records from the table called StudentList which contains more than one records like
Id Name
01 XXX
02 YYY
03 ZZZ
I tried to assign the result of the above query in a variable and while trying to log the variable, I can see the below
<student>
<Name>XXX</Name>
</student>
I want to have all the records from my table in xml format but it's not coming up. I get the value only from the first row of my table.
Please suggest.
regards,
Venkat -
Urgent - How to Run a FM using CATT script tool,
Hi All,
How to Run a FM using CATT script tool,
Thanks in advance,
KSRchoose type as "Function module test" (if you are in release less than 6.4 abap) after entering into t.code SCAT.
Pl. refer to this documentation for creating function module test cases
<a href="http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCCATTOL/CACATTOL.pdf">http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCCATTOL/CACATTOL.pdf</a>
reward if it helps
Krishna -
How to upload multiple files using wicket
Hai,
how to upload multiple files using wicket at a single browse.
any suggestion?
Thanks in advanceYou have to do this your self by either (as vinod said) using a different component (not present in adf) or implementing this:
1) allow the user to select multiple filenames (somehow)
2) zip them together
3) upload the zip
4) unpack the zip on the server
5) work with the files
Timo -
How to retrieve multiple columns using "returning" in the Insert query.
hi,
wanted to know how to retrieve multiple columns using "returning" in the Insert Query.
For retrieving one column we write the query as follows:
Insert into TABLE values(1,2,3,4) returning COLUMN1 into PARAMETER
But can we retrive multiple columns in the same query?
am using oracle 10g and coding in .NETHi,
You can definetely get multiple values from a single query using the 'returning' clause.
Eg : insert into emp (empno, ename, job, deptno) values (7324,'ADAM','MARKETING',30) returning ename, deptno into var1, var2; PN : var1 & var2 to be declared as varchar2 & number respectively.
More insight into the 'RETURNING' clause in this link.
http://www.samoratech.com/PLSQL/swArtPLSQLReturn.htm
Regards,
Bhanu. -
How to generate multiple sheets using xml publisher
Hi,
how to generate multiple sheets using xml publisher.
Thanks,
Nurhttp://lmgtfy.com/?q=how+to+generate+multiple+sheets+using+xml+publisher
-
How to proces the record in Table with multiple threads using Pl/Sql & Java
I have a table containing millions of records in it; and numbers of records also keep on increasing because of a high speed process populating this table.
I want to process this table using multiple threads of java. But the condition is that each records should process only once by any of the thread. And after processing I need to delete that record from the table.
Here is what I am thinking. I will put the code to process the records in PL/SQL procedure and call it by multiple threads of Java to make the processing concurrent.
Java Thread.1 }
Java Thread.2 }
.....................} -------------> PL/SQL Procedure to process and delete Records ------> <<<Table >>>
Java Thread.n }
But the problem is how can I restrict a record not to pick by another thread while processing(So it should not processed multiple times) ?
I am very much familiar with PL/SQL code. Only issue I am facing is How to fetch/process/delete the record only once.
I can change the structure of table to add any new column if needed.
Thanks in advance.
Edited by: abhisheak123 on Aug 2, 2009 11:29 PMCheck if you can use the bucket logic in your PLSQL code..
By bucket I mean if you can make multiple buckets of your data to be processed so that each bucket contains the different rows and then call the PLSQL process in parallel.
Lets say there is a column create_date and processed_flag in your table.
Your PLSQL code should take 2 parameters start_date and end_date.
Now if you want to process data say between 01-Jan to 06-Jan, a wrapper program should first create 6 buckets each of one day and then call PLSQL proc in parallel for these 6 different buckets.
Regards
Arun -
we are using VS 2013, I need to run multiple Coded UI Ordered Tests in parallel on different agents.
My requirement :
Example: I have 40 Coded UI Test scripts in single solution/project. i want to run in different OS environments(example 5 OS ). I have created 5 Ordered tests with the same 40 test cases.
I have one Controller machine and 5 test agent machines. Now I want my tests to be distributed in a way that every agent gets 1 Ordered test to execute.
Machine_C = Controller (Controls Machine_1,2,3,4,5)
Machine_1 = Test Agent 1 (Should execute Ordered Test 1 (ex: OS - WIN 7) )
Machine_2 = Test Agent 2 (Should execute Ordered Test 2 (ex:
OS - WIN 8) )
Machine_3 = Test Agent 3 (Should execute Ordered Test 3
(ex: OS - WIN 2008 server) )
Machine_4 = Test Agent 4 (Should execute Ordered Test 4 (ex:
OS - WIN 2012 server) )
Machine_5 = Test Agent 5 (Should execute Ordered Test 5 (ex:
OS - WIN 2003 server) )
I have changed the “MinimumTestsPerAgent” app setting value
as '1' in controller’s configuration file (QTController.exe.config).
When I run the Ordered tests from the test explorer all Test agent running with each Ordered test and showing the status as running. but with in the 5 Test Agents only 2 Agents executing the test cases remaining all 3 agents not executing the test cases but
status showing as 'running' still for long time (exp: More then 3 hr) after that all so its not responding.
I need to know how I can configure my controller or how I can tell it to execute these tests in parallel on different test agents. This will help me reducing the script execution time.
I am not sure what steps I am missing.
It will be of great help if someone can guide me how this can be achieved.
-- > One more thing Can I Run one Coded UI Ordered Test on One Specific Test Agent?
ex: Need to run ordered Test 1 in Win 7 OS (Test Agent 1) only.
Thanks in Advance.Hi Divakar,
Thank you for posting in MSDN forum.
As far as I know, we cannot specify coded UI ordered test run on specific test agent. And it is mainly that test controller determine which coded UI ordered test assign to which test agent.
Generally, I know that if we want to run multiple CodedUI Ordered Tests over multiple Test Agents for parallel execution using Test Controller.
We will need to change the MinimumTestsPerAgent property to 1 in the test controller configuration file (QTControllerConfig.exe.config) as you said.
And then we will need to change the bucketSize number of tests/number of machines in the test settings.
For more information about how to set this bucketSize value, please refer the following blog.
http://blogs.msdn.com/b/aseemb/archive/2010/08/11/how-to-run-automated-tests-on-different-machines-in-parallel.aspx
You can refer this Jack's suggestion to run your coded UI ordered test in lab Environment or load test.
https://social.msdn.microsoft.com/Forums/vstudio/en-US/661e73da-5a08-4c9b-8e5a-fc08c5962783/run-different-codedui-tests-simultaneously-on-different-test-agents-from-a-single-test-controller?forum=vstest
Best Regards,
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Can you suggest me how to run multiple calc scripts using singel maxl script
Hello,
I am writing a maxl script which should be able to :
1. update Set Variables for the Essbase DB
2. Execute multiple calc scripts
2a. Trying to put specific sleep time within multiple calc scripts.
Thanks and Regards.Why are you looking for a Maxl to run multiple maxls? Can't you use a batch or sh script to do it.
Unix has a sleep command in batch file try using choice
Regards
Celvin -
How to run multiple java files concurrently using command line?
Hi,
I have to write a script to run multiple java files and c files concurrently. Say, A and C are java files and B is another binary executable file, I have to make sure they are run in the order A-B-C, then I was trying to run by using
java A & ./B & java C
But it turned out that B could run before A started... Is there any way that I can ensure that A runs before B, and B runs before C by using the command line?
Thanks a lot.GKY wrote:
Sorry, I didn't make my question clear enough...
A has to give some output files that B needs to get started,Then B can start at any time--even before A--and just wait for those files to be written. For instance, A could write to a temp file, then rename it to the real name. However, if there are multiple files, and they all have to exist, even this won't necessarily work. There are other approaches that will though.
although writing the output takes very short time,Depends on when the OS decides to give A CPU time, what else is going on on that disk controller and/or network, etc.
B could still run before A finishes the writing, As it can if you sleep for 1, or 10, or 1,000,000 seconds before starting B.
if B can't find the info it wants, it fails to move on. That's why I need to make sure A starts before B.No, you need to make sure A's data is there before B tries to use that data.
Edited by: jverd on Jul 29, 2008 1:06 PM -
Java Thread : How to run a method using Thread
hi,
I have a method which i need to run with thread. Is there any way to do that. I have a code like below
public class parentClass extends Thread{
public static void main(String[] args){
ThreadClass threadClass = new ThreadClass()
Thread th = new Thread(threadClass.threadMethod("sample message"));
th.start();
System.out.println("Finished Threading");
public class ThreadClass(){
public threadMethod(String arg){
System.out.pritnln("Message received "+arg);
}thankQYou really seem very confused about alot of things.
If the code in your first posted code block compiled then it would have two threads. Not the one you said. But neither that example nor your follow up
are really making any sense. Statements like
//The main idea is it(childMethod()) will take lot of time for some arguments less time for some arguments.
// So that it will clear and can be available for other thread.indicate to me that you don't understand how threading works or what it is for.
Please start by reviewing the [_Concurrency tutorial_|http://java.sun.com/docs/books/tutorial/essential/concurrency/index.html]
Perhaps on completing that tutorial you may be able to formulate a question which can actually be answered. -
Can multiple threads use same transaction concurrently?
Is it possible that same transaction is being used by multiple threads concurrently
in WLS? If each thread is doing suspend and resume how does it work? Does the
transaction implementation support it? Is there a way to do it?
Why you don't tell us some more about your application?
I'm assuming this is a relatively long running transaction if run
serially. One common solution is to break this type of workflow into
several separate transactions with queues between them.
-- Rob
Karambir Singh wrote:
> Is there any workaround for this? I mean to something like explicitly associating
> the txn with user created threads.
>
> "krishna" <[email protected]> wrote:
>
>>Transaction context cannot be propagated to user created Threads.
>>-Krishna
>>"Karambir Singh" <[email protected]> wrote in message
>>news:[email protected]...
>>
>>>I'm starting a transaction in main thread and this thread spawns three
>>
>>threads.
>>
>>>I want updates done in main transaction and updates done in three child
>>
>>threads
>>
>>>to be part of the same transaction. The transaction is finally commited
>>
>>by
>>main
>>
>>>thread.
>>>
>>>
>>>
>>>
>>>
>>>"Dimitri I. Rakitine" <[email protected]> wrote:
>>>
>>>>What are you trying to do ?
>>>>
>>>>Karambir Singh <[email protected]> wrote:
>>>>
>>>>
>>>>>Is there any workaround to do this?
>>>>
>>>>>"Dimitri I. Rakitine" <[email protected]> wrote:
>>>>>
>>>>>>No, it is associated with a thread which started it.
>>>>>>
>>>>>>Karambir Singh <[email protected]> wrote:
>>>>>>
>>>>>>
>>>>>>>Is it possible that same transaction is being used by multiple
>>
>>threads
>>
>>>>>>concurrently
>>>>>>
>>>>>>>in WLS? If each thread is doing suspend and resume how does it
>>
>>work?
>>
>>>>>>Does the
>>>>>>
>>>>>>>transaction implementation support it? Is there a way to do it?
>>>>>>
>>>>>>--
>>>>>>Dimitri
>>>>>>
>>>>
>>>>--
>>>>Dimitri
>>>>
>>>
>>
>
Maybe you are looking for
-
All SCOM 2012 R2 dashboards are blank on Windows 7 for any user
All SCOM dashboards are showing up completely blank on several (but not all) Windows 7 machines and a 2008 R2 server (with RDS)...for any type of user. It's not a permissions issue as the same user can RDP to the SCOM Mgt server and view the dashboar
-
How to disable queryregion on OApage
hi, i have a mainRN which is of type header which has 3 child query regions each has got 1 messageLOV input, my requirement is to disable all the 3 query regions when pageloads, and depending on the values selected from the picklist i need to enable
-
Hi experts, So the CE system is a provider to the Portal system. If the above question is answered with yes, can you tell me which requirement we have to fulfill? See http://help.sap.com/saphelp_nwce711/helpdata/EN/48/7f585a7df935e1e10000000a42189c/c
-
Feature request - Disable packet data
I would like to make a feature request for the otherwise awesome phone Nokia Asha 302. You have done a great job there, the phone is very nice and popular. Can you please make an additional setting, so that we can DISABLE packet data completely? Curr
-
My old computer broke, so i got a mac. However, my iphone was already synced to the old computer, so i cannot put music anymore. This is because it is synced to my old computer. How do I sync it to work on my mac?