Produced by Araxis Merge on 6/11/2019 10:54:16 AM Eastern Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | HTRE_P3_v14.5_iter_4_build_14.zip\java\gov\va\med\fw\service\support | SpawnedThreadInvoker.java | Wed May 29 15:26:30 2019 UTC |
| 2 | HTRE_P3_v14.5_iter_4_build_14.zip\java\gov\va\med\fw\service\support | SpawnedThreadInvoker.java | Mon Jun 10 19:30:05 2019 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 282 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | /********* ********** ********** ********** ********** ********** ********* | |
| 2 | * Copyrii ght 2006 V HA. All ri ghts reser ved | |
| 3 | ********* ********** ********** ********** ********** ********** *********/ | |
| 4 | ||
| 5 | package go v.va.med.f w.service. support; | |
| 6 | ||
| 7 | import gov .va.med.fw .service.A bstractCom ponent; | |
| 8 | ||
| 9 | /** | |
| 10 | * Allows for generi c invocati on of a ta sk on a sp awned chil d thread. The | |
| 11 | * current thread ca n be confi gured to b lock or no t block. | |
| 12 | * | |
| 13 | * Created Apr 11, 2 006 1:45:4 9 PM | |
| 14 | * | |
| 15 | * @author DNS DN S
|
|
| 16 | */ | |
| 17 | public cla ss Spawned ThreadInvo ker extend s Abstract Component { | |
| 18 | pr otected st atic int S TATUS_SUCC ESS = 0; | |
| 19 | ||
| 20 | pr otected st atic int S TATUS_FAIL URE = 1; | |
| 21 | ||
| 22 | pr otected st atic int S TATUS_TIME OUT = 2; | |
| 23 | ||
| 24 | pr otected in t threadSt atus; | |
| 25 | ||
| 26 | pr otected Th rowable th readError; | |
| 27 | ||
| 28 | pr otected Ob ject threa dResult; | |
| 29 | ||
| 30 | pr otected Th read t; | |
| 31 | ||
| 32 | pr ivate int timeout = 120000; // default | |
| 33 | ||
| 34 | pr ivate bool ean blocki ng; | |
| 35 | ||
| 36 | pu blic Spawn edThreadIn voker(Spaw nedThreadT ask task) { | |
| 37 | this (task, fal se); | |
| 38 | } | |
| 39 | ||
| 40 | pu blic Spawn edThreadIn voker(Spaw nedThreadT ask task, boolean bl ocking) { | |
| 41 | t = new Spawne dThread(ta sk, this); | |
| 42 | this .blocking = blocking ; | |
| 43 | } | |
| 44 | ||
| 45 | pu blic void execute() { | |
| 46 | if ( blocking) { | |
| 47 | synchr onized (t) { | |
| 48 | t.start( ); | |
| 49 | try { | |
| 50 | t.wait(tim eout); | |
| 51 | } catch (Interrupt edExceptio n e) { | |
| 52 | throw new RuntimeExc eption( | |
| 53 | "Spa wned threa d has been interrupt ed, should not occur ", e); | |
| 54 | } | |
| 55 | } | |
| 56 | } el se { | |
| 57 | t.star t(); | |
| 58 | } | |
| 59 | } | |
| 60 | ||
| 61 | pr otected Th read getCu rrentThrea d() { | |
| 62 | retu rn t; | |
| 63 | } | |
| 64 | ||
| 65 | pu blic void abort() { | |
| 66 | if ( t != null) | |
| 67 | t.inte rrupt(); | |
| 68 | } | |
| 69 | ||
| 70 | /* * | |
| 71 | * @return R eturns the timeout. | |
| 72 | * / | |
| 73 | pu blic int g etTimeout( ) { | |
| 74 | retu rn timeout ; | |
| 75 | } | |
| 76 | ||
| 77 | /* * | |
| 78 | * @param ti meout | |
| 79 | * The time out to set . | |
| 80 | * / | |
| 81 | pu blic void setTimeout (int timeo ut) { | |
| 82 | this .timeout = timeout; | |
| 83 | } | |
| 84 | ||
| 85 | pu blic boole an isTimed Out() { | |
| 86 | retu rn threadS tatus == S TATUS_TIME OUT; | |
| 87 | } | |
| 88 | ||
| 89 | pu blic boole an isFaile d() { | |
| 90 | retu rn threadS tatus == S TATUS_FAIL URE; | |
| 91 | } | |
| 92 | ||
| 93 | pu blic Throw able getEr ror() { | |
| 94 | retu rn threadE rror; | |
| 95 | } | |
| 96 | ||
| 97 | pu blic Objec t getResul t() { | |
| 98 | retu rn threadR esult; | |
| 99 | } | |
| 100 | ||
| 101 | /* * | |
| 102 | * @return R eturns the blocking. | |
| 103 | * / | |
| 104 | pu blic boole an isBlock ing() { | |
| 105 | retu rn blockin g; | |
| 106 | } | |
| 107 | ||
| 108 | /* * | |
| 109 | * @param bl ocking | |
| 110 | * The bloc king to se t. | |
| 111 | * / | |
| 112 | pu blic void setBlockin g(boolean blocking) { | |
| 113 | this .blocking = blocking ; | |
| 114 | } | |
| 115 | } | |
| 116 | ||
| 117 | class Spaw nedThread extends Th read { | |
| 118 | pr ivate Spaw nedThreadT ask task; | |
| 119 | ||
| 120 | pr ivate Spaw nedThreadI nvoker inv oker; | |
| 121 | ||
| 122 | pu blic Spawn edThread(S pawnedThre adTask tas k, Spawned ThreadInvo ker invoke r) { | |
| 123 | this .task = ta sk; | |
| 124 | this .invoker = invoker; | |
| 125 | } | |
| 126 | ||
| 127 | pu blic void run() { | |
| 128 | try { | |
| 129 | invoke r.threadSt atus = Spa wnedThread Invoker.ST ATUS_TIMEO UT; | |
| 130 | invoke r.threadRe sult = tas k.execute( ); | |
| 131 | invoke r.threadSt atus = Spa wnedThread Invoker.ST ATUS_SUCCE SS; | |
| 132 | } ca tch (Throw able t) { | |
| 133 | invoke r.threadSt atus = Spa wnedThread Invoker.ST ATUS_FAILU RE; | |
| 134 | invoke r.threadEr ror = t; | |
| 135 | } fi nally { | |
| 136 | synchr onized (th is) { | |
| 137 | notify() ; | |
| 138 | } | |
| 139 | invoke r.t = null ; | |
| 140 | } | |
| 141 | } | |
| 142 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.