Scripting with beanshell - making a thread solution...

Ok here is the problem i have and are looking for ideas how to solve it. We have a single threadded server that are using beanshell scripts.
Now... inside the scripts we want to be able to sleep (wait).
For example:
void run(){
    print("test");
    wait(5); // wait 5 seconds
    print("test2");
}So what i would basically want is that the script is put into somekind of queue, where it will reside for 5 seconds. And then the server would step through the queue and if 5 seconds has passed it would continue executing...
Is there any "easy" solution to fix this?

The only solution i come up with so far is making the script call a "script manager" to do the waiting, and with that add a "callback" method.
So the script would be like
run(){
  print("test");
  manager.wait(2, "step2()");
step2(){
  print("test2");
}The manager would take care of making sure that the callback method is called at the correct time.

Similar Messages

  • Scripting with Beanshell in CLM

    Hello,
    I'm wondering if someone can provide me with a document that outlines how to use the beanshell script in e-sourcing/CLM.  Also, an example of an input field vlidation script would help get us on the right track.
    Thanks in advance,
    Kyle

    Hi Siri,
    If you are talking about budgeted/estimated cost of project template then you can write the script this way to validate :
    PriceIfc budgetedValue= doc.getBudgetedValue();
    PriceIfc estimatedValue=doc.getEstimatedValue();
            if(hasValue(budgetedValue))
                BigDecimal projectValue=budgetedValue.getPrice();
                log("projectValue--"+projectValue);
                if(totalContractValue.getPrice()<=0.0000 )
                    log("projectValue is less than or equal to 0.0000 --");
                    //throw error
            else
                //throw error
    This way you can validate both whether project has price, if not would throw an error. If project has price and if it is equal then also it would throw error. Please use necessary imports.
    Regards,
    Kumud

  • Can anyone help with Automator/Scripts with Mail Items

    I have a set up a smart folder in mail and it shows about 100 emails. These vary in content, addresses and recipients. The emails also have an extended threads.
    I need to generate a report with the emails (including threads) by subject time, date. etc.
    It will need to analyse the From: To: Date: Time: Subject: for each of the top email and also (all the threads within each email).
    How could Automator be scripted to do such a task. Manually it will be very time consuming and difficult.
    1. I am a newbee to automator and scripting is this likely to be beyond me?
    2. Are there any good sources of scripts available on the web which could be adapted?
    3. What is the recommended reading for writing, applying and using Scripting?
    iMac G5 Mac OS X (10.4.6) Airport Extreme; PalmT5
    iMac G5   Mac OS X (10.4.6)   Airport Extreme; PalmT5

    Thank you for taking the time to reply. I was finally able to figue out what to do. So far today everything is fine.
    Most Sincerely,
    Glenda

  • I have a bare minimum script with the following line (also had the line echo Hello World, but removed for simplicity).

    I have a bare minimum script with the following line (also had the line echo Hello World, but removed for simplicity).
    #!/bin/sh  <-- only line of code currently in the file
    when I try to run, I get the following error.  Likewise if the line is #!/bin/bash, but /bin/bash is then the bad interpreter.
    -bash: ./test.sh /bin/sh: bad interpreter: Operation not permitted
    I'm running from a terminal window.
    Any helpful hints for resolution?  Thank you in advance.

    I did some more searching and found the answer here: https://discussions.apple.com/thread/3733470?start=30&tstart=0
    I obtained TextWrangler and recreated the file.
    Thank you for your input.

  • Give some refrence to learn Java Script with HTML5lo mates,

    Hello mates,
    Can anybody please prvodi me a good refrence to learn java script with HTML5. Yes, i am new to HTML5 and Java.
    Anybody have a good refrence.
    Please Share.
    Thanks

    Sorry for misspell in thread heading.

  • Searching for scripts with Spotlight

    I decided to ask this question on this forum because AppleScripters are the most likely to search for scripts with Spotlight.
    *First, here’s what seems to be the normal behavior of Spotlight:*
    If I open the folder “/Users/pierre/Documents/Loisirs/Informatique/Utilisation avancée/AppleScript”, type ⌘F and enter “Kind is Other” and “script” as the search criterion, I get 89 items in the +Searching “AppleScript”+ window.
    On the other hand, if I replace the previous criterion with “File extension is scpt”, I get 88 items in the +Searching “AppleScript”+ window, which is normal since one of my scripts is a script bundle, whose extension is “scptd”.
    Next, if I open my home folder, type ⌘F again and enter “Kind is Other” and “script” as the search criterion, I get 110 items in the +Searching “pierre”+ window, which again is normal since many of my scripts are outside of my “AppleScript” folder.
    *Now, here’s what looks like a bug:*
    If I replace the previous criterion with “File extension is scpt” in my home folder, I get only 3 items (instead of 109) in the +Searching “pierre”+ window, which obviously is nonsense.
    I have rebuilt permissions and reindexed Spotlight, without any difference.
    Any explanation?

    Hi Pierre
    Not a explanation, but a possible solution, try some of these ideas:::
    1) Restart Mac
    2) Rebuild the spot light index manually (I no you said you have done this, this is just a path to follow):
    a) launch terminal
    b) type this sudo mdutil -E /
    c) type in your admin password when prompted
    d) rebuilding index should commence (could take a while)
    3) clear the spot light caches and prefs:
    a) download "Yasu" from here and install
    http://jimmitchelldesign.com/yasu/
    b) enable "Reset System Prefs", "Clear System font Cache", "Clear local font cache", "Clear user font cache"
    click ok
    c) Restart Mac
    4) Kill the SystemUIServer:
    a) launch activity monitor, find process "SystemUIServer" highlight then click button quit process
    hope this helps
    Budgie

  • Error when generating Alter Record scripts with project PPLTLS84CUR

    I am trying to install HR89 + PT849 on REL5.4 + Oracle 10g manually under the guideline of official document: PeopleTools 8.49 Installation for Oracle.pdf
    After Database creation, need to upgrade Peopletools from the delivered version 8.46 to 8.49
    In page 570, Task B-15-6: Alter PeopleTools Tables, need to generate build scripts from project PPLTLS84CUR and then run the scripts from SQLPLUS side.
    Bu when generating the scripts with user PS/PS, the App Designer got error message as following:
    PS General Routines
    Out of available memory. -
    e:\pt849-903-R1-retail\peopletoos\SRC\pssys\rdmfld.app @ 998
    click OK, process can continue but the result can show: "Error: APPR_RULE_HDR - Alter process was unsuccessful. (76,42) "
    not only this record but also many others.
    In client PC which running app designer, the memory is enough for app designer, 1G free. Really hard to understand such error.
    Any reply will be much appreciated.
    Andy
    Edited by: Andy xu on 2012-5-14 上午2:22

    thank you for your reply.
    client pc is running on windows 7 and UAC is already disabled.
    current user running app designer is belong to Administrator group, hence, this may be a client security problem.
    I search on oracle website and found a page said this maybe a bug and be fixed from 8.49.11, this is why it is working on 8.49.13, and the wordaround solution is use non-vista pc, such as windows xp. :)
    https://support.oracle.com/CSP/ui/flash.html#tab=KBHome(page=KBHome&id=()),(page=KBNavigator&id=(from=BOOKMARK&viewingMode=1143&bmDocTitle=E-QR:%20When%20modifying%20Criteria%20for%20certain%20Queries,%202-tier/3-tier%20Query%20Manager%20tool%20is%20generating%20error,%20%22Out%20of%20available%20memory%20-%20e:pt84814b%20-%20retailpeopletoolsSRCpssysqdmsel.cpp@1381%22&bmDocType=PROBLEM&bmDocDsrc=KB&bmDocID=659150.1))

  • Setup JOB to run sh script with argument

    Hi all,
    Can anyone share your view and experience on How to setup Job to execute shell script with argument?
    For example : I need to execute /export/home/joel/test.sh 20060921
    20060921 is the argument.
    If I define a program to execute the script, can I use DEFINE_PROGRAM_ARGUMENT to set the argument?
    I am not sure because I have the understanding that it will only work with STORED_PROCEDURE program type.
    How does Oracle Scheduler handle such case?
    I really appreaciate your response.
    Thanks

    Hi,
    The thread above contains information specific to shell scripts. For stored procedures you just set job_type to 'stored_procedure' , number_of_arguments to the number of arguments that you want to pass into the stored procedure and then call set_job_argument_value for each argument before finally enabling the job . So for example
    begin
    dbms_scheduler.create_job(
    job_name=>'j1',
    job_type=>'stored_procedure',
    job_action=>'dbms_output.put_line',
    number_of_arguments=>1);
    dbms_scheduler.set_job_argument_value('j1', 1, 'this is my argument');
    dbms_scheduler.enable('j1');
    end;
    Hope this helps,
    Ravi.

  • Running a PS script with elevated privilages

    This is what I would like:User opens the script with PowerShellUser must enter password of domain admin (secure string)Script starts running as Domain AdminI have not been able to find any solution for this, 
    any help would be appreciated!

    Hello,Currently I have a batch script that moves files of a certain type from one folder to an archive folder with the current date. The script I use for this is:Batchfilefor /f "tokens=1* delims=" %%a in ('date /T') do set datestr=%%amkdir C:\ArchiveReportFiles\Archive\%date:/=%robocopy /E C:\eFinancials\report C:\ArchiveReportFiles\Archive\%date:/=% *.pdf /mov /minage:100 This works fine but it looks at the date modified not the date created so i still have files from over 2 years in there if somebody opened them by mistake, so I'm trying to recreate the the same script but using Powershell so I can use the CreationTime variable. I've got this:Powershell$dirname = "$((get-date).toString('dd-MM-yyyy'))"New-Item -ItemType directory -Path "C:\aa_Mine\test\PowershellTest\testto\$dirname"get-childitem -Path "C:\aa_Mine\test\PowershellTest...

  • GP logon script with PowerShell

    We have a Windows Server 2012 domain and would like to create a GP logon script with PowerShell.
    So if you execute the .ps1 file, the specified logon script settings (including parameters) would be applied automatically in the GP.
    Any idea of such command line?

    Thanks for the tips!
    May not be the easiest solution, but it works:
    I created a backup of the GPO set fully graphical interface, and I've copied ps1 file in the same folder.
    #Start
    #Create GPO
    $gponame = "Program_AutoStart"
    Write-Host ""
    $ou = Read-Host "What is your Organisational Unit name?"
    Write-Host ""
    $enforce = Read-Host "Do you want enforce Group Policy link? (Yes/No)"
    $dc1 = $env:userdnsdomain
    $dc1length = $env:userdnsdomain.Length
    $dc1s = $env:userdnsdomain.Split(".")
    $dc1count = $dc1s[$dc1s.Count-1].Length+1
    $dc1max = $dc1length-$dc1count
    $dc1 = $dc1.Substring(0,$dc1max)
    $dc2 = $env:userdnsdomain.Split(".")
    $dc2 = $dc2[$dc2.Count-1]
    Write-Host ""
    Write-Host -Object "Create a new Group Policy Object..."
    #replace GPO settings
    ##backup.xml file
    $backupFilePath = ".\backup\{2F708EB2-F154-4739-8F6D-1F16C954649C}\Backup.xml"
    $content = Get-Content -path $backupFilePath
    $content | foreach { $_.Replace("mydomainname","$env:userdnsdomain") } | Set-Content $backupFilePath
    $content = Get-Content -path $backupFilePath
    $content | foreach { $_.Replace("mycomputername","$env:COMPUTERNAME") } | Set-Content $backupFilePath
    $content = Get-Content -path $backupFilePath
    $content | foreach { $_.Replace("mynetbiosname","$env:userdomain") } | Set-Content $backupFilePath
    ##backup.xml file
    $bkupinfoFilePath = ".\backup\{2F708EB2-F154-4739-8F6D-1F16C954649C}\bkupinfo.xml"
    $content = Get-Content -path $bkupinfoFilePath
    $content | foreach { $_.Replace("mydomainname","$env:userdnsdomain") } | Set-Content $bkupinfoFilePath
    $content = Get-Content -path $bkupinfoFilePath
    $content | foreach { $_.Replace("mycomputername","$env:COMPUTERNAME") } | Set-Content $bkupinfoFilePath
    $content = Get-Content -path $bkupinfoFilePath
    $content | foreach { $_.Replace("mynetbiosname","$env:userdomain") } | Set-Content $bkupinfoFilePath
    ##gpreport.xml file
    $gpreportFilePath = ".\backup\{2F708EB2-F154-4739-8F6D-1F16C954649C}\gpreport.xml"
    $programexe = "$env:logonserver\$share\My_Program\program.exe"
    $content = Get-Content -path $gpreportFilePath
    $content | foreach { $_.Replace("mycommand","$programexe") } | Set-Content $gpreportFilePath
    Write-Host ""
    $parameters = Read-Host "Add your parameters"
    $content = Get-Content -path $gpreportFilePath
    $content | foreach { $_.Replace("myparameters","$parameters") } | Set-Content $gpreportFilePath
    ##scripts.ini file
    $gpreportFilePath = ".\backup\{2F708EB2-F154-4739-8F6D-1F16C954649C}\DomainSysvol\GPO\User\Scripts\scripts.ini"
    $content = Get-Content -path $gpreportFilePath
    $content | foreach { $_.Replace("mycommand","$programexe") } | Set-Content $gpreportFilePath
    $content = Get-Content -path $gpreportFilePath
    $content | foreach { $_.Replace("myparameters","$parameters") } | Set-Content $gpreportFilePath
    #Import GPO and link
    Write-Host ""
    Write-Host -Object "Import Group Policy settings..."
    Import-GPO -BackupGpoName "$gponame" -TargetName "$gponame" -Path ".\backup" -CreateIfNeeded
    New-GPLink -Name "$gponame" -target "ou=$ou,dc=$dc1,dc=$dc2" -Enforced $enforce -LinkEnabled Yes
    #Replace undo
    ##backup.xml file
    $content = Get-Content -path $backupFilePath
    $content | foreach { $_.Replace("$env:userdnsdomain","mydomainname") } | Set-Content $backupFilePath
    $content = Get-Content -path $backupFilePath
    $content | foreach { $_.Replace("$env:COMPUTERNAME","mycomputername") } | Set-Content $backupFilePath
    $content = Get-Content -path $backupFilePath
    $content | foreach { $_.Replace("$env:userdomain","mynetbiosname") } | Set-Content $backupFilePath
    ##backup.xml file
    $content = Get-Content -path $bkupinfoFilePath
    $content | foreach { $_.Replace("$env:userdnsdomain","mydomainname") } | Set-Content $bkupinfoFilePath
    $content = Get-Content -path $bkupinfoFilePath
    $content | foreach { $_.Replace("$env:COMPUTERNAME","mycomputername") } | Set-Content $bkupinfoFilePath
    $content = Get-Content -path $bkupinfoFilePath
    $content | foreach { $_.Replace("$env:userdomain","mynetbiosname") } | Set-Content $bkupinfoFilePath
    ##gpreport.xml file
    $content = Get-Content -path $gpreportFilePath
    $content | foreach { $_.Replace("$programexe","mycommand") } | Set-Content $gpreportFilePath
    $content = Get-Content -path $gpreportFilePath
    $content | foreach { $_.Replace("$parameters","myparameters") } | Set-Content $gpreportFilePath
    ##scripts.ini file
    $content = Get-Content -path $gpreportFilePath
    $content | foreach { $_.Replace("$programexe","mycommand") } | Set-Content $gpreportFilePath
    $content = Get-Content -path $gpreportFilePath
    $content | foreach { $_.Replace("$parameters","myparameters") } | Set-Content $gpreportFilePath
    #End

  • Hello hi, i just won't to ask, if there has been any changes on how to find a stolen phone, did some one come up with a fare and good solution. as it is not fare at all when some one could use it for free and there is a lot of things could be done to this

    hello hi, i just won't to ask, if there has been any changes on how to find a stolen phone, did some one come up with a fare and good solution, new Apps. as it is not fare at all when some one could use it for free and there is a lot of things could be done to this condition, no one seem to care,
    i have a story about my sister, am talking on her behalf, she got stolen her phone at a caffee when she just come from a horeble exam, she was very mad and having haedace for not doing well at the exam, i ask her if we could have coffee before we go home, once she sate; while i was getting the coffee for her, some one snicked to her pocket and took the phone, immidatly she feelt it and went on to searching, but nathing was hopefull. what makes it more heart braking is that she worked day and night just to buy the phone and pay for her books and so on as a student. she use to work 16 houres a day before she had to start school. 8 houres in one place and then to the other place. and she was always demanding for more houres to work; one day her boss saw her on her other job and she was serprised to see her and saied OHhh my God Milly if you work like this, i wonder if you servive, how could you also ask for more houres, My sis had to do it she has no parents or any thing, well the phone was taken after only two months of having it. the sad thing is she stile dream having it even though she can't think of buying againe. well me i have tryed a lot of things but i know some were out there there is a solution for people like this, it is not always fare for some one who has payed up to 800 to just loose his ......  
    Thnks

    I'm sorry, but your sister, unless she had already turned on the "Find my iPhone" feature and the person who took the phone has not disabled it, is out of luck. She should report the theft to local police authorities, including the serial number of her iPhone. While her experience is unfortunate, there are good reasons why Apple cannot do anything else about it.
    I hope she gets her phone back.
    Best of luck.

  • IC WebClient Connectivity with ICI and Third Party Solution (Genesys)

    <b>Hi Techies,
                 Can any body give the information about the IC WebClient Connectivity with ICI and Third Party Solution (Especially Chat and Mail Configuration with Web Client in CRM). We are using CRM 5.0 server with Java+Abap Engine.  I need configuration for Web Client Genesys(Third Party) with ICI configuration.  I dont have idea regarding this. I 've little idea on Business Communication Broker.  Can any help me out in this regard.   Thanks in an advance. If u have any document it can be acceptable.
    Regds,</b>
    Govinda
    [email protected]

    We are looking for a site to site model. I want all the devices on the remote network to be on their own subnet. We need to be able to hit individual remote devices from the head end. The devices at the remote site in turn also need to be able to communicate with each other without having to use the VPN.

  • Which is better approach to manage sharepoint online - PowerShell Script with CSOM or Console Application with CSOM?

    Which is better approach to manage sharepoint online - PowerShell Script with CSOM or Console Application with CSOM?
    change in sharepoint scripts not require compilation but anything else?

    Yes, PowerShell is great, since you can quick change your code without compilation.
    SP admin can write ps scripts without specific tools like Visual Studio.
    With powershell you can use cmdlets,
    which could remove a lot of code, for example restarting a service.
    [custom.development]

  • ECATT Script with SAPGUI Commando works in consolidation but not in prod.

    Hi experts,
    I created a eCATT script with commando SAPGUI Rec. In our consolidation system it works fine but when I try to let it run in production it is not working. User scripting is enabled (in options and in rz11). I am starting the script, the production system is getting opened but afterwards there happens nothing anymore. Also the scriptingsign in the bottom right corner is not active.
    When I am running a script with TCD Rec, it works fine in production. Is there a difference between settings for scripting for TCD Rec and SAPGUI scripting? Do you have any idea which kind of influences there could be that make this difference between TCD Rec and SAPGUI Rec scripts?
    Best regards and thank you in advance!
    Jan

    Hello,
    Ideally we should not run the ecatts in the production system as this would hamper the system environment or change systems.
    Also check in RZ11 enter sapgui/user_scripting , here the values for the last three parameters are set to TRUE.
    Thanks & Best regards,
    Ajay

  • Calling an rss script with rs.exe fails to result in a report pdf from VB6 w/ ShellEx.

    Sql 2008 R2
    Calling an rss script with rs.exe fails to result in a report pdf from VB6 w/ ShellEx. 
    If I call rs.exe with the various parameters from the command prompt I  have success(other than rs.exe using the temp folder, which is a different issue).  But when I try to execute the same process from a Visual Basic 6.0 application utilizing
    the ShellEx api call, the report creation and output to PDF format do not occur.   There is no error raised.
    Yes, I wish I could use a newer dev tool but that isn't an option right now. I think this should work.  Can ya'll tell me what I'm doing wrong?
    sArgs = "-i " & Chr(34) & "'C:\Program Files\Dura Supreme\OrderEntry\RunOrdReports.rss'" & Chr(34) & _
    " -s 'http://walnut/reportserver' -v 'DuraOrderNum=" & _
    Chr(34) & sOrdDuraID & Chr(34) & "' -e Exec2005 -t"
    ShellEx Chr(34) & "C:\Program Files\Dura Supreme\OrderEntry\rs.exe" & Chr(34), EShellShowConstants.essSW_SHOWNORMAL, sArgs
    TIA,
    Jim M.

    ShellEx Chr(34) & "C:\Program Files\Dura Supreme\OrderEntry\rs.exe" & ....
    Hello Jim,
    The path for rs.exe includes spaces, you should set it in hyphen, as you already did for file "RunOrdReports.rss" in variable "sArgs2
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

Maybe you are looking for

  • Ist Generation Apple TV is very hot and will not reset

    Our 1st generation Apple TV has not been working since we had a recent power cut; I have let it cool down -- very hot to touch -- and tried the MENU and MINUS button held down for 6 seconds, as Apple advise, but, nothing! The orange light of doom con

  • Problem with package imports

    Hi all, When I use the code import javax.mail.*; import javax.mail.internet.*;the message import javax.mail.*; cannot be resolved is shownI have added jaf-1_1_1.zip and javamail-1_4_1.zip to the project's build path in eclipse. Then why do I get this

  • New Tab button missing after upgrade to 7.0.1

    I prefer not to have the Tab Bar showing unless I have more than one tab open, but I sometimes like to open a blank tab, so that I can open a link from an email into it. (Not the default for me.) Alas, ever since I upgraded to Firefox 7.0.1 from the

  • Sent Mail Suddenly Says "must go online"

    Hi, I'm using OS 10.3.9 with Mac Mail 1.3.11. Recently, my sent mail has not been appearing. The name of the sender, date sent and topic show up, but the contents of the messages say "must go online" or something like that to download from the server

  • On versions 4, what happeded to the Stop Loading "X" command that used be on the upper-left toolbar?

    I just downloaded Ver. 4.0. After doing so, I've noticed that the Stop Loading command, the X that used to reside in the upper left of the toolbar, is now gone. I've searched, but cannot find a process for replacing it. This used to be a valuable too