Using Start-Job to launch multiple SSH sessions and esxtop?

Hello folks,
I am trying to start an esxtop session on multiple esx servers at the same time.
I started trying using Start-Job thinking it would help do it asynchronously.
The script I have below works on one host so far, but need suggestions to repeat it for multiple hosts, thinking by looping through changing the $i each time?
Checking if anyone would have comment?
$i = 1
$seconds = 5
$iterations = 2
$esxtopfile = "esxtop$i_$((Get-Date).ToString('MMddyyy-hhmm')).csv"
$ComputerName = "z420esxi$i.domain.net"
# Start an esxtop session using SSH.net and start an esxtop command - module already loaded.
$sb = {New-SshSession -ComputerName $($args[0]) -KeyFile C:\esxi-key-openssh.key -Username root
       Invoke-SshCommand -ComputerName $($args[0]) -command "esxtop -d $($args[1]) -a -b -n $($args[2]) > /tmp/$($args[3])"     
Start-Job  -ScriptBlock $sb -ArgumentList $ComputerName,$seconds,$iterations,$esxtopfile | Wait-Job | Receive-Job

A: Using Start-Job to launch multiple SSH sessions and esxtop?

You're starting for a job, waiting for that job to complete and then finally receiving that job
before allowing anything else to happen with your script.
In other words, if you had some code after the Start-Job line, it would not be executed until the job had completed and you had received the job, which partially negates the benefits of using a job to begin with (specially bearing in mind you don't have
a form).
The way to achieve what you're after is to start all jobs at the same time, one per ESX host, and then finally to wait for all jobs and collect all jobs at the end.
Here's a quick example that starts 5 jobs and wait for all of them to complete before receiving the results.
$jobs = @()
$jobs += 1..5 | ForEach-Object {Start-Job -ScriptBlock {Sleep $args[0]; "I just slept for $($args[0]) seconds"} -ArgumentList $_}
[void] (Wait-Job $jobs)
Receive-Job $jobs
Notice that each of the subsequent jobs will take longer and longer to run, with the first being the fastest and the last the slowest. Still, I'm waiting for *all* jobs to complete before performing the Receive-Jobs on all of them at the same time.

You're starting for a job, waiting for that job to complete and then finally receiving that job
before allowing anything else to happen with your script.
In other words, if you had some code after the Start-Job line, it would not be executed until the job had completed and you had received the job, which partially negates the benefits of using a job to begin with (specially bearing in mind you don't have
a form).
The way to achieve what you're after is to start all jobs at the same time, one per ESX host, and then finally to wait for all jobs and collect all jobs at the end.
Here's a quick example that starts 5 jobs and wait for all of them to complete before receiving the results.
$jobs = @()
$jobs += 1..5 | ForEach-Object {Start-Job -ScriptBlock {Sleep $args[0]; "I just slept for $($args[0]) seconds"} -ArgumentList $_}
[void] (Wait-Job $jobs)
Receive-Job $jobs
Notice that each of the subsequent jobs will take longer and longer to run, with the first being the fastest and the last the slowest. Still, I'm waiting for *all* jobs to complete before performing the Receive-Jobs on all of them at the same time.

Similar Messages

  • PowerShell using start job to run multiple code blocks at the same time

    I will be working with many 1000’s of names in a list preforming multiple function on each name for test labs.
    I notice when it is running the functions on each name I am using almost no CPU or memory.  That led me to research can I run multiple threads at once in a PowerShell program. That lead me to articles suggesting start-job would do just want I am looking
    for. 
    As a test I put this together.  It is a simple action as an exercise to see if this is indeed the best approach.  However it appears to me as if it is still only running the actions on one name at a time.
    Is there a way to run multiple blocks of code at once?
    Thanks
    Start-Job {
    $csv1 = (Import-Csv "C:\Copy AD to test Lab\data\Usergroups1.csv").username
    foreach ($name1 in $csv1) { Write-Output "Job1 $name1"}
    Start-Job {
    $csv2 = (Import-Csv "C:\Copy AD to test Lab\data\Usergroups2.csv").username
    foreach ($name2 in $csv2) { Write-Output " Job2 $name2"}
    Get-Job | Receive-Job
    Lishron

    You say your testing shows that you are using very little cpu or memory in processing each name, which suggests that processing a single name is a relatively trivial task.  
    You need to understand that using a background job is going to spin up another instance of powershell, and if you're going to do that per name what used to require a relatively insignificant amount of memory is going to take around 60 MB.  
    Background jobs are not really well suited for multi-threading short-running, trivial tasks.  The overhead of setting up and tearing down the job session can be more than the task itself.
    Background jobs are good for long-running tasks.  For multi-threading short, trivial tasks runspaces or a workflow would probably be a better choice.
    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

  • Receive location of job after using Start-job command

    Hey all so I have a script that installs software on remote machines. I've recently started using Psexec to start installing as the System account, however now I am not able to keep track of the location that Psexec is running on. The old method I could
    call the variable I stored the job in "$job.location" and receive the location but now when I do this I get localhost.
    Here's the code:
    ###Software Install methods
    if($checkboxUserInstall.Checked){
    #Uses users creds to install software
    foreach($item in $computersForInstall){
    $installArrayJobs += Invoke-Command -ComputerName $item -ScriptBlock {cmd /c "C:\Package\$($args[0])"} -ArgumentList $softwareInstallerName -AsJob -Credential $cred
    }else{
    #New PsExec Install method
    $installString = { PsExec.exe "\\$($args[0])" -s -accepteula "C:\Package\$($args[1])" }
    Write-Host "Starting $($software[$index][0]) Installs.."
    foreach($item in $computersForInstall){
    $installArrayJobs += Start-Job $installString -ArgumentList $item, $softwareInstallerName
    I think I understand why, the top invoke command is actually invoking that command on the remote machine so it is able to keep track of the location. The bottom is using Psexec to invoke the command and cannot keep track of it. 
    So long story short is there anyway I can keep track of the location while using the bottom Psexec method and the Start-Job command?
    Thanks.

    You can leverage the -Name property of Start-Job to keep track of the server the job was for.
    ###Software Install methods
    if($checkboxUserInstall.Checked){
    #Uses users creds to install software
    foreach($item in $computersForInstall){
    $installArrayJobs += Invoke-Command -ComputerName $item -ScriptBlock {cmd /c "C:\Package\$($args[0])"} -ArgumentList $softwareInstallerName -AsJob -Credential $cred
    }else{
    #New PsExec Install method
    $installString = { PsExec.exe "\\$($args[0])" -s -accepteula "C:\Package\$($args[1])" }
    Write-Host "Starting $($software[$index][0]) Installs.."
    foreach($item in $computersForInstall){
    $installArrayJobs += Start-Job $installString -Name $item -ArgumentList $item, $softwareInstallerName
    Now, instead of the default Job1, Job2, etc. job names, each job will have a name that matches the server the job was for.
    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

  • How to use Start-Job?

    Hello folks,
    I am trying to setup a simple Start-Job command.  This basic command works for me and copies the file correctly.
    Start-Job -Scriptblock {Copy-Item -Path \\192.168.32.25\share\butterfly.jpg -Destination c:\test\ -Recurse -Verbose}
    However, it does not work when I try using variable like this.
    $source = "\\192.168.32.25\share\butterfly.jpg"
    $target = "c:\test\"
    Start-Job -Scriptblock {Copy-Item -Path $source -Destination $target -Recurse -Verbose}
    Anyone have suggestions for getting this to work with variables?
    Thanks,
    romatlo

    Hi,
    Here's some information:
    http://powershell.org/wp/forums/topic/passing-parameter-to-start-job/
    https://social.technet.microsoft.com/Forums/scriptcenter/en-US/ff644fca-1b25-4c8a-9a8a-ce90eb024389/in-powershell-how-do-i-pass-startjob-arguments-to-a-script-using-param-style-arguments?forum=ITCG
    Basically, look at using -ArgumentList:
    http://ss64.com/ps/start-job.html
    Don't retire TechNet! -
    (Don't give up yet - 13,225+ strong and growing)

  • How to use "Start synchronous Call" to run a subVi and keep timeout event in Main vi still running?

    Hi, All
    I have a application need periodically check an instrument status and I put it in the "Timeout Event" in main vi. I also need call some subVis for configuration etc. Somehow when I called those subvi, the Timeout event in my main vi was not running. Then I use " Start Asynchronous Call" function to call the subVis. Turns out it works fine with some subvis without return value, but not as expected with "return value-needed" subvis. 
    I attached a simple test, my main vi call two dlg subvis: AboutDlg.vi and SettingsDlg.vi. In the timeout event, I just use a counter for simulation. When you run it, you can see the counter keep counting when the AboutDlg.vi was called, but stopped when SettingsDlg.vi was called. 
    As I remembered, someone suggested to use Queue to pass return value, but I don't know how to implement it here. 
    Anyone has any suggestions about it? 
    Thank you very much. 
    CQ
    Solved!
    Go to Solution.
    Attachments:
    AsyCallTest.llb ‏108 KB

    Try playing with this - I have modified  your code to poke a Q in there.
    You will want to change the clusters to more useful datatypes (maybe enum and variant so you can unbundle variants depending on enum input), you will want to type def the clusters to make it easier to maintain and you will NEED to handle the sitaution where the called VI is left open on program close - i couldn't be bothered as this was not your immediate issue)
    Hope this give you some Ideas - totalyy untested but should work.
    James
    Attachments:
    AsyCallTest.llb ‏114 KB

  • I have acp medicine cd. I copied it to hard disk. Now used start.htm to launch the webpage based application.table of contents is not loading, search not workin

    acp medicine cd is version 2006. I have java 7 update 45.
    Java Plug-in 10.45.2.18
    Using JRE version 1.7.0_45-b18 Java HotSpot(TM) Client VM
    User home directory = C:\Users\Admin.lt01
    c: clear console window
    f: finalize objects on finalization queue
    g: garbage collect
    h: display this help message
    l: dump classloader list
    m: print memory usage
    o: trigger logging
    q: hide console
    r: reload policy configuration
    s: dump system and deployment properties
    t: dump thread list
    v: dump thread stack
    x: clear classloader cache
    0-5: set trace level to <n>
    basic: Added progress listener: sun.plugin.util.ProgressMonitorAdapter@1786789
    basic: Plugin2ClassLoader.addURL parent called for file:/E:/Apps/ACPCD/ACPCD/sam.jar
    network: Cache entry not found [url: file:/E:/Apps/ACPCD/ACPCD/sam.jar, version: null]
    basic: Added progress listener: sun.plugin.util.ProgressMonitorAdapter@177b4d3
    network: Cache entry not found [url: file:/E:/Apps/ACPCD/ACPCD/sam.jar, version: null]
    network: Cache entry not found [url: file:/E:/Apps/ACPCD/ACPCD/sam.jar, version: null]
    basic: Plugin2ClassLoader.addURL parent called for file:/E:/Apps/ACPCD/ACPCD/sam_java/tree.jar
    security: Accessing keys and certificate in Mozilla user profile: null
    network: Created version ID: 1.7.0.45
    network: Created version ID: 1.7.0.45
    network: Cache entry not found [url: file:/E:/Apps/ACPCD/ACPCD/sam_java/tree.jar, version: null]
    network: Cache entry not found [url: file:/E:/Apps/ACPCD/ACPCD/sam_java/tree.jar, version: null]
    network: Cache entry not found [url: file:/E:/Apps/ACPCD/ACPCD/sam_java/tree.jar, version: null]
    0
    basic: Embedding dialogs not enabled in Configuration
    security: SSV validation:
    running: 1.7.0_45
    requested: null
    range: null
    javaVersionParam: null
    Rule Set version: null
    network: Created version ID: 1.7.0.45
    network: Created version ID: 1.7.0.45
    security: continue with running version
    network: Created version ID: 1.7.0.45
    network: Created version ID: 1.7
    network: Created version ID: 2.2.45
    security: SSV validation:
    running: 1.7.0_45
    requested: null
    range: null
    javaVersionParam: null
    Rule Set version: null
    network: Created version ID: 1.7.0.45
    network: Created version ID: 1.7.0.45
    security: continue with running version
    network: Created version ID: 1.7.0.45
    network: Created version ID: 1.7
    network: Created version ID: 2.2.45
    basic: Applet loaded.
    basic: Applet resized and added to parent container
    basic: PERF: AppletExecutionRunnable - applet.init() BEGIN ; jvmLaunch dt 2891122 us, pluginInit dt 12593728 us, TotalTime: 15484850 us
    basic: Applet loaded.
    basic: Applet resized and added to parent container
    basic: PERF: AppletExecutionRunnable - applet.init() BEGIN ; jvmLaunch dt 2891122 us, pluginInit dt 12910284 us, TotalTime: 15801406 us
    basic: Applet initialized
    basic: Starting applet
    basic: completed perf rollup
    basic: Applet made visible
    basic: Applet started
    basic: Told clients applet is started
    java.net.MalformedURLException: no protocol: data.gz
    JObjects QuestAgent
    Copyright (c) 1997-2002, JObjects International. All rights reserved.
    http://www.jobjects.com
    java.io.IOException: Failed to open file for read: sam.prm
    at com.jobjects.quest.e.c.a(c.java:55)
    at com.jobjects.quest.e.c.a(c.java:63)
    at com.jobjects.quest.e.c.a(c.java:31)
    at com.jobjects.quest.agent.GenericSearchApplet.init(GenericSearchApplet.java:51)
    at com.jobjects.quest.agent.LiveConnectApplet.init(LiveConnectApplet.java:166)
    at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter.init(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    [ERROR] Can't load applet parameters from sam.prm <java.io.IOException: Failed to open file for read: sam.prm>
    [DEBUG] Detected browser: sun.plugin
    [DEBUG] Creating search panel.
    [DEBUG] Search panel created.
    [DEBUG] Search applet initialized.
    basic: Applet initialized
    basic: Starting applet
    basic: completed perf rollup
    basic: Applet made visible
    basic: Applet started
    basic: Told clients applet is started

    Did it work when you started it directly from the CD?
    Does it work if you open start.htm in Internet Explorer?
    I don't have much experience with Java issues, but one thing to try would be to clear Java's cache, which is separate from your browser caches. This article has the steps: [http://www.java.com/en/download/help/plugin_cache.xml How do I clear the Java cache?]

  • How to restrict multiple ess session and access?

    Hi experts,
    how to restrict multiple session for ess user? and multi access for same ess user?
    our problem is when user login to ess (doing session, for example leave request) and at the same time their manager is accessing travel approval task for that user, the approval process getting error. (we use travel workflow to approve travel request)
    how to overcome this situation?
    thanks.

    but there is no information on ESS screen for user being lock.
    how to show the information on ess screen?
    thanks

  • RDS 2012 R2 - Allow Some Users Multiple Logon Sessions and Restrict Other Users to a Single Session

    In Server 2012 R2 RDS, is there a way to allow some users to log on multiple times, but restrict other users to a single logon? On an OU or AD group basis?
    I know there is a GPO setting under Computer Configuration for restricting users to a single logon, but this does not allow me to differentiate on a user basis (only on a per server basis).
    Thanks,
    James

    Hi James,
    From my perspective and knowledge, sorry to say but there is no such option\way to provide this permission at same time. If a user specifies a different program to start when the user connects to the RD Session Host server, a new session will be created on
    the RD Session Host server for the user, even if the RD Session Host server is configured to restrict users to a single session. A user can specify a program to start on connection on the Programs tab under Options in Remote Desktop Connection.
    Hope it helps!
    Thanks.
    Dharmesh Solanki
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Does firefox create multiple restore sessions and save them?

    Sometimes my computer crashes twice in a row, or things happen similar to this. When this happens, the "Restore Session" is not available on the history dropdown menu. Why is that? Is there a way to make this happen? No way can I go through the total history - thousands of websites and some don't say what they are when looking at the URL or title. I don't want to save all the time - this is a basic function that could easily be done automatically.
    Is there a solution to this?

    Firefox should not be crashing, if t is maybe that is something to investigate.
    Firefox does try to save Restore Sessions, but if you close down incorrectly or crash frequently they are going to get messed up.
    Always try to close correctly, which on an XP will be by using the File option (Newer Windows sytems have the quit option under the new Firefox Button)
    Have a look at the article
    * [[Restore previous session - Configure when Firefox shows your most recent tabs and windows]]
    * and also possibly consider [[firefox hangs#w_delete-duplicated-session-restore-files]]_delete-duplicated-session-restore-files
    If you are getting crashes see [[firefox crashes]]

  • When I go to start up FireFox it says "restore session" and than goes to "Not responding" how can I fix this?

    I tried to uninstall and re-install version 6. I am running windows 7

    To switch to the UK store, read here: http://support.apple.com/kb/HT1311.

  • PowerShell - Start-Job - Synchronised Array list

    Hi all,
    I am trying to write a script using start-job against a list of machines. The script is to query a target machine event log using get-winevent cmdlet. I supply the whole code that queries the eventlog in a scriptblock. In order to capture the output (one
    psobject for each of the scriptblock jobs) I am trying to use a synchronised arraylist. I do not know the full details of how to use the synchronised arraylist but I have put together the below script (by referring to some of the online articles). But the
    script does not work as intended. The individual scriptblocks do not seem to be referring to the global arraylist variable while appending the results.
    Would any of you be able to shed any light on it?
    Please note, the script without the PowerShell Jobs works fine(that is linear execution which is really time-consuming). Also, even with using psJobs, the script works when I try to dump the result of each job into a csv from within the job itself. But I
    want to avoid this situation because due to the asynchronous execution there might be contention for the csv by more than one jobs at the same time. Hence I want to use the synchronised array list.
    $InputCSV = "$(Split-Path $SCRIPT:MyInvocation.MyCommand.Path -parent)\backupexec.csv"
    $OutputCSV = "$(Split-Path $SCRIPT:MyInvocation.MyCommand.Path -parent)\Reports\BackupExec_Output_$(Get-Date -format "ddMMyyyy")_$((Get-Date).DayOfWeek).csv"
    $OutputArray = [System.Collections.ArrayList]::Synchronized((New-Object System.Collections.ArrayList))
    $counter=1
    $jobs=@{};
    $jobcounter=0;
    Import-CSV $InputCSV | ForEach {
    $Comp_Name=$_.ServerName;
    $Counter+=1;
    $Scriptblock={
    Try {
    $IsthereAnyResult= @()
    $IsthereAnyResult= Get-WinEvent -ComputerName $Using:Comp_Name -ErrorAction SilentlyContinue -FilterHashTable @{LogName='application';ProviderName='Backup Exec';ID=57755; StartTime=(Get-Date).AddDays(-1)}
    $props = @{
    "Server Name" = ($event.MachineName -split '\.')[0];
    "Event ID" = $event.ID;
    "Time Logged" = $event.TimeCreated;
    "Backup Result" = Switch ($event.ID) { '57755' {"Success - Skipped"}
    '34113' {"Failed"}
    '34112' {"Success"} };
    "Message" = $event.Properties[0].value -replace '\n' -replace '\r';
    $OutputArray += New-Object PSObject -Property $props
    } #end try get-winevent
    Catch { } #end Catch
    } #end scriptblock
    $jobs[$jobcounter]= Start-job -name $("Job_$jobcounter") -ScriptBlock $Scriptblock
    $jobcounter+=1;
    While((Get-Job -State 'Running').Count -ge 10) {
    Start-Sleep -Milliseconds 10
    } # end main foreach
    Get-Job | Wait-Job
    $OutputArray | Select-Object "Server Name","Event ID","Time Logged","Backup Result","Message" | Export-CSV -force -Path $OutputCSV -NoTypeInformation -Append

    How about this?
    I use wmi win32_ntlogevent which i prefer ..  Timeservice is just for example ...
    Change the scriptblock to your needs and report the result :]
    Param ([int]$BatchSize=2)
    #list of servers
    [array]$source = (get-adcomputer -filter {name -like "server*"}) |select -expandproperty dnshostname
    $blok = {
    get-wmiobject Win32_NTLogEvent -Filter "(Logfile='System') and (SourceName = 'Microsoft-Windows-Time-Service')" |select -first 10 |select __server,@{n="EventCode";e={switch($_.EventCode){37{"37 - Receiving"}35{"35 - Synchronizing"}129{"129 - NTP Fail"}default{"Other EventCode"}}}},@{n="Date";e={$_.ConvertToDateTime($_.TimeGenerated)}},message
    $elapsedTime = [system.diagnostics.stopwatch]::StartNew()
    $result = @()
    $itemCount = 0
    ## checking running jobs
    if (get-job|? {$_.name -like "Script*"}){
    write-host "ERROR: There are pending background jobs in this session:" -back red -fore white
    get-job |? {$_.name -like "Script*"} | out-host
    write-host "REQUIRED ACTION: Remove the jobs and restart this script" -back black -fore yellow
    $yn = read-host "Automatically remove jobs now?"
    if ($yn -eq "y"){
    get-job|? {$_.name -like "Script*"}|% {remove-job $_}
    write-host "jobs have been removed; please restart the script" -back black -fore green
    exit
    $i = 0
    $itemCount = $source.count
    Write-Host "Script will run against $itemcount servers!"
    ## Script start time mark
    write-host "Script started at $(get-date -uFormat "%Y/%m/%d %H:%M:%S")".padright(60) -back darkgreen -fore white
    write-host " (contains $itemCount unique entries)" -back black -fore green
    $activeJobCount = 0
    $totalJobCount = 0
    write-host "Submitting background jobs..." -back black -fore yellow
    for ($i=0; $i -lt $itemCount;$i += $batchSize){
    $activeJobCount += 1; $totalJobCount += 1; $HostList = @()
    $HostList += $source |select -skip $i -first $batchsize
    $j = invoke-command -computername $Hostlist -scriptblock $blok -asjob
    $j.name = "Script`:$totalJobCount`:$($i+1)`:$($getHostList.count)"
    write-host "+" -back black -fore cyan -nonewline
    write-host "`n$totaljobCount jobs submitted, checking for completed jobs..." -back black -fore yellow
    while (get-job |? {$_.name -like "Script*"}){
    foreach ($j in get-job | ? {$_.name -like "Script*"}){
    $temp = @()
    if ($j.state -eq "completed"){
    $temp = @()
    $temp += receive-job $j
    $result += $temp
    remove-job $j
    $ActiveJobCount -= 1
    write-host "-" -back black -fore cyan -nonewline
    elseif ($j.state -eq "failed"){
    $temp = $j.name.split(":")
    if ($temp[1] -eq "R"){
    $temp = @()
    $temp += receive-job $j
    $result += $temp
    remove-job $j
    $ActiveJobCount -= 1
    write-host "-" -back black -fore cyan -nonewline
    else{
    write-host "`nFailure detected in job: $($j.name)" -back black -fore red
    $temp = @()
    $temp += receive-job $j
    $result += $temp
    remove-job $j
    $ActiveJobCount -= 1
    if ($result.count -lt $itemCount){
    sleep 3
    write-host " "
    write-host "Script finished at $(get-date -uFormat "%Y/%m/%d %H:%M:%S")".padright(60) -back darkgreen -fore white
    write-host (" Elapsed Time : {0}" -f $($ElapsedTime.Elapsed.ToString())) -back black -fore green
    $result |select __server,eventcode,Date,message |ft -auto
    write-host " Script completed all requested operations at $(get-date -uFormat "%Y/%m/%d %H:%M:%S")".padright(60) -back darkgreen -fore white
    write-host (" Elapsed Time : {0}" -f $($ElapsedTime.Elapsed.ToString())) -back black -fore green

  • Single cycle set , multiple cycle sets and counters

    Hi every one,
    i wanan know the use of single cycle set, multiple cycle set and counters. What kind of functionalilites can be covered by these fields specially in performance based planning and schedulling. Kindly give me some documentation on all three or some good example which can explain the scnerio clearly. Any help would be of great imprortance for me.
    Regards
    Abhishek Sinha

    Hi,
    This may help you
    http://help.sap.com/saphelp_46C/helpdata/EN/b0/df293581dc1f79e10000009b38f889/frameset.htm
    Regds
    Vinit

  • Question abt session and need advise in designing the project

    Hi,
    I am developing an application which searches for a particular document in some kind of database and returns the results and when the user clicks on one of the results, it should show the corresponding document from the db. Now I could get that functionality in my app. But my question is right now I am planning to store the document in temp folder and giving it back to the user for a particular session and am going to use a file name specific to the session and particular document for storing the docs.
    My questions:
    I want to delete the file after the session times out/user closes the window.How do I do that?
    And also please advise me if the whole thing is the right approach to achieve the functionality of the application considering the performance issues. I am using JSP and java classes right now.
    I am completely a beginner and was asked to develop this application on my own.
    Please help me out.
    Thanks

    javax.servlet.http.HttpSessionBindingListener
    or
    javax.servlet.http.HttpSessionListener
    The former, you have to create a class that implements that interface and store an instance of that class in the session and leave it there. When the session expires, the object is removed and valueUnbound() is called.
    The latter, you have to create a class that implements that interface and there's some way in the web.xml format to specify listeners (I forget offhand).

  • Running multiple IE sessions each using different version of RE

    I understand that it is being said that multiple versions of the JRE can be run in different browser sessions. However, multiple versions cannot be run in the same browser session. I have 2 web applications one uses 1.3.1_04 and the other 1.4.2_10. How can I get two sessions for both appl running simultaniously without having IE problems? Right now the only way I am able to manage from one appl to the other is as follow: I can login to the one appl successfully, then have to logoff and shut down all IE windows, restart a new IE session and login to the other appl. Right now it appears that once I login to one appl, the JRE is loaded to IE, and then shared in all windows and subsequent sessions untill I shut all exisiting IE windows down. The problem is encountered irrespect of how I start a new session: I usually go from one appl to the other through clicking on my favorites, but I have also tried holding shift down when clicking on other favorite, clicked on IE shortcut while other IE window is open to open a new session..but it seems only way IE clears itself is to completely start IE fresh over again so then IE will know which required JRE to load.
    Unchecking Reuse Windows for Launching Shortcuts partly resolved the issue.
    Message was edited by:
    hfm2chase

    I hope this helps.
    http://forum.java.sun.com/thread.jspa?threadID=722556&messageID=4261109

  • Run Multiple SSIS Packages in parallel using SQL job

    Hi ,
    We have a File Watcher process to determine the load of some files in a particular location. If files are arrived then another package has to be kick-started.
    There are around 10 such File Watcher Processes to look for 10 different categories of files. All 10 File Watcher have to be started at the same time.
    Now these can be automated by creating 10 different SQL jobs which is a safer option. But if a different category file arrives then another job has to be created. Somehow I feel this is not the right approach.
    Another option is to create one more package and execute all the 10 file watcher packages as 10 different execute packages in parallel.
    But incase if they don’t execute in parallel, i.e., if any of the package waits for some resources, then it does not satisfy our functional requirement . I have to be 100% sure that all 10 are getting executed in parallel.
    NOTE: There are 8 logical processors in this server.
    (SELECT cpu_count FROM sys.dm_os_sys_info
    i.e., 10 tasks can run in parallel, but somehow I got a doubt that only 2 are running exactly in parallel and other tasks are waiting. So I just don’t want to try this  option.
    Can someone please help me in giving the better way to automate these 10 file watcher process in a single job.
    Thanks in advance,
    Raksha
    Raksha

    Hi Jim,
    For Each File Type there are separate packages which needs to be run.
    For example package-A, processes FileType-A and package-B processes FileType-B. All these are independent processes which run in parrallel as of now. 
    The current requirement is to have File Watcher process for each of these packages. So now FileWatcher-A polls for FileType-A and if any of the filetype-A is found it will kick start package-A. In the same way there is FileWatcher-B, which looks for FileType-B
    and starts Package-B when any of FileType-B is found. There are 10 such File Watcher processes.
    These File Watcher Processes are independent and needs to start daily at 7 AM and run for 3 hrs. 
    Please let me know if is possible to run multiple packages in parallel using SQL job.
    NOTE: Some how I find it as a risk, to run these packages in parallel using execute package task and call that master package in job. I feel only 2 packages are running in parallel and other packages are waiting for resources.
    Thanks,
    Raksha
    Raksha

Maybe you are looking for