|
Lines 49-64
Link Here
|
| 49 |
import org.omg.PortableServer.Servant; |
49 |
import org.omg.PortableServer.Servant; |
| 50 |
import org.omg.PortableServer.ServantActivator; |
50 |
import org.omg.PortableServer.ServantActivator; |
| 51 |
|
51 |
|
| 52 |
import edu.emory.mathcs.backport.java.util.concurrent.Callable; |
|
|
| 53 |
import edu.emory.mathcs.backport.java.util.concurrent.ExecutionException; |
| 54 |
import edu.emory.mathcs.backport.java.util.concurrent.Executor; |
| 55 |
import edu.emory.mathcs.backport.java.util.concurrent.FutureTask; |
| 56 |
import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; |
| 57 |
import edu.emory.mathcs.backport.java.util.concurrent.TimeoutException; |
| 58 |
import edu.emory.mathcs.backport.java.util.concurrent.locks.Condition; |
| 59 |
import edu.emory.mathcs.backport.java.util.concurrent.locks.Lock; |
| 60 |
import edu.emory.mathcs.backport.java.util.concurrent.locks.ReentrantLock; |
| 61 |
|
| 62 |
/** |
52 |
/** |
| 63 |
* JacORB implementation of CORBA object reference |
53 |
* JacORB implementation of CORBA object reference |
| 64 |
* |
54 |
* |
|
Lines 101-108
Link Here
|
| 101 |
private final Set pending_replies = new HashSet(); |
91 |
private final Set pending_replies = new HashSet(); |
| 102 |
private final Barrier pending_replies_sync = new Barrier(); |
92 |
private final Barrier pending_replies_sync = new Barrier(); |
| 103 |
|
93 |
|
| 104 |
private final Lock bind_sync = new ReentrantLock(); |
94 |
private final java.lang.Object bind_sync = new java.lang.Object(); |
| 105 |
private final Condition isConnected = bind_sync.newCondition(); |
|
|
| 106 |
|
95 |
|
| 107 |
private boolean locate_on_bind_performed = false; |
96 |
private boolean locate_on_bind_performed = false; |
| 108 |
|
97 |
|
|
Lines 130-138
Link Here
|
| 130 |
private boolean useIMR; |
119 |
private boolean useIMR; |
| 131 |
private boolean locateOnBind; |
120 |
private boolean locateOnBind; |
| 132 |
|
121 |
|
| 133 |
ThreadPerTaskExecutor executor = null; |
122 |
/** |
| 134 |
|
|
|
| 135 |
/** |
| 136 |
* 03-09-04: 1.5.2.2 |
123 |
* 03-09-04: 1.5.2.2 |
| 137 |
* |
124 |
* |
| 138 |
* boolean threadlocal to ensure that |
125 |
* boolean threadlocal to ensure that |
|
Lines 172-178
Link Here
|
| 172 |
super(); |
159 |
super(); |
| 173 |
|
160 |
|
| 174 |
this.orb = orb; |
161 |
this.orb = orb; |
| 175 |
this.executor = new ThreadPerTaskExecutor(); |
|
|
| 176 |
} |
162 |
} |
| 177 |
|
163 |
|
| 178 |
public Delegate ( org.jacorb.orb.ORB orb, ParsedIOR pior ) |
164 |
public Delegate ( org.jacorb.orb.ORB orb, ParsedIOR pior ) |
|
Lines 298-306
Link Here
|
| 298 |
*/ |
284 |
*/ |
| 299 |
private void bind(boolean rebind) |
285 |
private void bind(boolean rebind) |
| 300 |
{ |
286 |
{ |
| 301 |
bind_sync.lock(); |
287 |
synchronized (bind_sync) |
| 302 |
|
|
|
| 303 |
try |
| 304 |
{ |
288 |
{ |
| 305 |
if ( bound ) |
289 |
if ( bound ) |
| 306 |
{ |
290 |
{ |
|
Lines 367-373
Link Here
|
| 367 |
|
351 |
|
| 368 |
case LocateStatusType_1_2._OBJECT_HERE : |
352 |
case LocateStatusType_1_2._OBJECT_HERE : |
| 369 |
{ |
353 |
{ |
| 370 |
isConnected.signalAll(); |
|
|
| 371 |
break; |
354 |
break; |
| 372 |
} |
355 |
} |
| 373 |
|
356 |
|
|
Lines 420-431
Link Here
|
| 420 |
} |
403 |
} |
| 421 |
|
404 |
|
| 422 |
} |
405 |
} |
| 423 |
|
406 |
|
| 424 |
} |
|
|
| 425 |
finally |
| 426 |
{ |
| 427 |
//wake up threads waiting for the pior |
407 |
//wake up threads waiting for the pior |
| 428 |
bind_sync.unlock(); |
408 |
bind_sync.notifyAll(); |
| 429 |
} |
409 |
} |
| 430 |
} |
410 |
} |
| 431 |
|
411 |
|
|
Lines 445-452
Link Here
|
| 445 |
|
425 |
|
| 446 |
public void rebind(ParsedIOR ior) |
426 |
public void rebind(ParsedIOR ior) |
| 447 |
{ |
427 |
{ |
| 448 |
bind_sync.lock(); |
428 |
synchronized ( bind_sync ) |
| 449 |
try |
|
|
| 450 |
{ |
429 |
{ |
| 451 |
// Do the ParsedIORs currently match. |
430 |
// Do the ParsedIORs currently match. |
| 452 |
final ParsedIOR originalIOR = getParsedIOR(); |
431 |
final ParsedIOR originalIOR = getParsedIOR(); |
|
Lines 495-504
Link Here
|
| 495 |
|
474 |
|
| 496 |
bind(); |
475 |
bind(); |
| 497 |
} |
476 |
} |
| 498 |
finally |
|
|
| 499 |
{ |
| 500 |
bind_sync.unlock(); |
| 501 |
} |
| 502 |
} |
477 |
} |
| 503 |
|
478 |
|
| 504 |
public org.omg.CORBA.Request create_request( org.omg.CORBA.Object self, |
479 |
public org.omg.CORBA.Request create_request( org.omg.CORBA.Object self, |
|
Lines 817-839
Link Here
|
| 817 |
|
792 |
|
| 818 |
ClientConnection getConnection() |
793 |
ClientConnection getConnection() |
| 819 |
{ |
794 |
{ |
| 820 |
bind_sync.lock(); |
795 |
synchronized ( bind_sync ) |
| 821 |
try |
|
|
| 822 |
{ |
796 |
{ |
| 823 |
bind(); |
797 |
bind(); |
| 824 |
return connection; |
798 |
return connection; |
| 825 |
} |
799 |
} |
| 826 |
finally |
|
|
| 827 |
{ |
| 828 |
bind_sync.unlock(); |
| 829 |
} |
| 830 |
} |
800 |
} |
| 831 |
|
801 |
|
| 832 |
public org.omg.IOP.IOR getIOR() |
802 |
public org.omg.IOP.IOR getIOR() |
| 833 |
{ |
803 |
{ |
| 834 |
bind_sync.lock(); |
804 |
synchronized ( bind_sync ) |
| 835 |
|
|
|
| 836 |
try |
| 837 |
{ |
805 |
{ |
| 838 |
if ( piorOriginal != null ) |
806 |
if ( piorOriginal != null ) |
| 839 |
{ |
807 |
{ |
|
Lines 841-892
Link Here
|
| 841 |
} |
809 |
} |
| 842 |
return getParsedIOR().getIOR(); |
810 |
return getParsedIOR().getIOR(); |
| 843 |
} |
811 |
} |
| 844 |
finally |
|
|
| 845 |
{ |
| 846 |
bind_sync.unlock(); |
| 847 |
} |
| 848 |
} |
812 |
} |
| 849 |
|
813 |
|
| 850 |
public byte[] getObjectId() |
814 |
public byte[] getObjectId() |
| 851 |
{ |
815 |
{ |
| 852 |
bind_sync.lock(); |
816 |
synchronized ( bind_sync ) |
| 853 |
try |
|
|
| 854 |
{ |
817 |
{ |
| 855 |
bind(); |
818 |
bind(); |
| 856 |
|
819 |
|
| 857 |
return POAUtil.extractOID( getParsedIOR().get_object_key() ); |
820 |
return POAUtil.extractOID( getParsedIOR().get_object_key() ); |
| 858 |
} |
821 |
} |
| 859 |
finally |
|
|
| 860 |
{ |
| 861 |
bind_sync.unlock(); |
| 862 |
} |
| 863 |
} |
822 |
} |
| 864 |
|
823 |
|
| 865 |
public byte[] getObjectKey() |
824 |
public byte[] getObjectKey() |
| 866 |
{ |
825 |
{ |
| 867 |
bind_sync.lock(); |
826 |
synchronized ( bind_sync ) |
| 868 |
try |
|
|
| 869 |
{ |
827 |
{ |
| 870 |
bind(); |
828 |
bind(); |
| 871 |
|
829 |
|
| 872 |
return getParsedIOR().get_object_key(); |
830 |
return getParsedIOR().get_object_key(); |
| 873 |
} |
831 |
} |
| 874 |
finally |
|
|
| 875 |
{ |
| 876 |
bind_sync.unlock(); |
| 877 |
} |
| 878 |
} |
832 |
} |
| 879 |
|
833 |
|
| 880 |
public ParsedIOR getParsedIOR() |
834 |
public ParsedIOR getParsedIOR() |
| 881 |
{ |
835 |
{ |
| 882 |
bind_sync.lock(); |
836 |
synchronized ( bind_sync ) |
| 883 |
try |
|
|
| 884 |
{ |
837 |
{ |
| 885 |
while ( _pior == null ) |
838 |
while ( _pior == null ) |
| 886 |
{ |
839 |
{ |
| 887 |
try |
840 |
try |
| 888 |
{ |
841 |
{ |
| 889 |
isConnected.await(); |
842 |
bind_sync.wait(); |
| 890 |
} |
843 |
} |
| 891 |
catch ( InterruptedException ie ) |
844 |
catch ( InterruptedException ie ) |
| 892 |
{ |
845 |
{ |
|
Lines 896-905
Link Here
|
| 896 |
|
849 |
|
| 897 |
return _pior; |
850 |
return _pior; |
| 898 |
} |
851 |
} |
| 899 |
finally |
|
|
| 900 |
{ |
| 901 |
bind_sync.unlock(); |
| 902 |
} |
| 903 |
} |
852 |
} |
| 904 |
|
853 |
|
| 905 |
public void resolvePOA (org.omg.CORBA.Object self) |
854 |
public void resolvePOA (org.omg.CORBA.Object self) |
|
Lines 1044-1049
Link Here
|
| 1044 |
interceptors.handle_send_request(); |
993 |
interceptors.handle_send_request(); |
| 1045 |
} |
994 |
} |
| 1046 |
|
995 |
|
|
|
996 |
|
| 1047 |
try |
997 |
try |
| 1048 |
{ |
998 |
{ |
| 1049 |
if ( !ros.response_expected() ) // oneway op |
999 |
if ( !ros.response_expected() ) // oneway op |
|
Lines 1065-1101
Link Here
|
| 1065 |
pending_replies.add(receiver); |
1015 |
pending_replies.add(receiver); |
| 1066 |
} |
1016 |
} |
| 1067 |
|
1017 |
|
| 1068 |
// send the request by a background thread |
1018 |
synchronized (bind_sync) |
| 1069 |
// |
1019 |
{ |
| 1070 |
|
1020 |
if (ros.getConnection() == connection) |
| 1071 |
SendJob sendJob = new SendJob(ros, receiver); |
1021 |
{ |
| 1072 |
FutureTask task = new FutureTask(sendJob); |
1022 |
// RequestOutputStream has been created for |
| 1073 |
|
1023 |
// exactly this connection |
| 1074 |
executor.execute(task); |
1024 |
connection.sendRequest(ros, receiver, ros.requestId(), true); // response |
| 1075 |
|
1025 |
// expected |
| 1076 |
try |
1026 |
} |
| 1077 |
{ |
1027 |
else |
| 1078 |
task.get(getTimeLeft(ros), TimeUnit.MILLISECONDS); |
1028 |
{ |
| 1079 |
} |
1029 |
logger.debug("invoke: RemarshalException"); |
| 1080 |
catch (InterruptedException e) |
1030 |
|
| 1081 |
{ |
1031 |
// RequestOutputStream has been created for |
| 1082 |
throw new TRANSIENT("interrupted while sending the request"); |
1032 |
// another connection, so try again |
| 1083 |
} |
1033 |
throw new RemarshalException(); |
| 1084 |
catch (ExecutionException e) |
1034 |
} |
| 1085 |
{ |
1035 |
} |
| 1086 |
if(e.getCause() instanceof SystemException) |
|
|
| 1087 |
{ |
| 1088 |
throw (SystemException)e.getCause(); |
| 1089 |
} |
| 1090 |
else |
| 1091 |
{ |
| 1092 |
throw new RuntimeException(e); |
| 1093 |
} |
| 1094 |
} |
| 1095 |
catch (TimeoutException e) |
| 1096 |
{ |
| 1097 |
throw new TIMEOUT(e.getMessage()); |
| 1098 |
} |
| 1099 |
} |
1036 |
} |
| 1100 |
catch ( org.omg.CORBA.SystemException cfe ) |
1037 |
catch ( org.omg.CORBA.SystemException cfe ) |
| 1101 |
{ |
1038 |
{ |
|
Lines 1113-1119
Link Here
|
| 1113 |
} |
1050 |
} |
| 1114 |
|
1051 |
|
| 1115 |
interceptors.handle_receive_exception ( cfe ); |
1052 |
interceptors.handle_receive_exception ( cfe ); |
| 1116 |
|
1053 |
|
| 1117 |
// The exception is a TRANSIENT, so try rebinding. |
1054 |
// The exception is a TRANSIENT, so try rebinding. |
| 1118 |
if ( cfe instanceof org.omg.CORBA.TRANSIENT && try_rebind() ) |
1055 |
if ( cfe instanceof org.omg.CORBA.TRANSIENT && try_rebind() ) |
| 1119 |
{ |
1056 |
{ |
|
Lines 1121-1128
Link Here
|
| 1121 |
} |
1058 |
} |
| 1122 |
|
1059 |
|
| 1123 |
throw cfe; |
1060 |
throw cfe; |
| 1124 |
} |
1061 |
} |
| 1125 |
finally |
1062 |
finally |
| 1126 |
{ |
1063 |
{ |
| 1127 |
if (orb.hasRequestInterceptors()) |
1064 |
if (orb.hasRequestInterceptors()) |
| 1128 |
{ |
1065 |
{ |
|
Lines 1144-1194
Link Here
|
| 1144 |
return null; |
1081 |
return null; |
| 1145 |
} |
1082 |
} |
| 1146 |
|
1083 |
|
| 1147 |
private long getTimeLeft(RequestOutputStream ros2) |
|
|
| 1148 |
{ |
| 1149 |
UtcT timo = ros2.getReplyEndTime(); |
| 1150 |
long timoMillies = java.lang.Long.MAX_VALUE; |
| 1151 |
|
| 1152 |
if(timo != null) |
| 1153 |
{ |
| 1154 |
timoMillies = org.jacorb.util.Time.millisTo(timo); |
| 1155 |
} |
| 1156 |
return(timoMillies); |
| 1157 |
} |
| 1158 |
|
| 1159 |
public void doSend(RequestOutputStream ros, ReplyReceiver receiver) throws RemarshalException, InterruptedException |
| 1160 |
{ |
| 1161 |
long timo = getTimeLeft(ros); |
| 1162 |
|
| 1163 |
if( bind_sync.tryLock(timo, TimeUnit.MILLISECONDS) == false) |
| 1164 |
{ |
| 1165 |
throw new TIMEOUT("TIMO while doSend "); |
| 1166 |
} |
| 1167 |
|
| 1168 |
try |
| 1169 |
{ |
| 1170 |
if (ros.getConnection() == connection) |
| 1171 |
{ |
| 1172 |
// RequestOutputStream has been created for |
| 1173 |
// exactly this connection |
| 1174 |
connection.sendRequest(ros, receiver, ros.requestId(), true); // response |
| 1175 |
// expected |
| 1176 |
} |
| 1177 |
else |
| 1178 |
{ |
| 1179 |
logger.debug("invoke: RemarshalException"); |
| 1180 |
|
| 1181 |
// RequestOutputStream has been created for |
| 1182 |
// another connection, so try again |
| 1183 |
throw new RemarshalException(); |
| 1184 |
} |
| 1185 |
} |
| 1186 |
finally |
| 1187 |
{ |
| 1188 |
bind_sync.unlock(); |
| 1189 |
} |
| 1190 |
} |
| 1191 |
|
| 1192 |
private void invoke_oneway (RequestOutputStream ros, |
1084 |
private void invoke_oneway (RequestOutputStream ros, |
| 1193 |
ClientInterceptorHandler interceptors) |
1085 |
ClientInterceptorHandler interceptors) |
| 1194 |
throws RemarshalException, ApplicationException |
1086 |
throws RemarshalException, ApplicationException |
|
Lines 1240-1247
Link Here
|
| 1240 |
|
1132 |
|
| 1241 |
private boolean try_rebind() |
1133 |
private boolean try_rebind() |
| 1242 |
{ |
1134 |
{ |
| 1243 |
bind_sync.lock(); |
1135 |
synchronized ( bind_sync ) |
| 1244 |
try |
|
|
| 1245 |
{ |
1136 |
{ |
| 1246 |
if( logger.isDebugEnabled()) |
1137 |
if( logger.isDebugEnabled()) |
| 1247 |
{ |
1138 |
{ |
|
Lines 1336-1345
Link Here
|
| 1336 |
return false; |
1227 |
return false; |
| 1337 |
} |
1228 |
} |
| 1338 |
} |
1229 |
} |
| 1339 |
finally |
|
|
| 1340 |
{ |
| 1341 |
bind_sync.unlock(); |
| 1342 |
} |
| 1343 |
} |
1230 |
} |
| 1344 |
|
1231 |
|
| 1345 |
public void invokeInterceptors( ClientRequestInfoImpl info, short op ) |
1232 |
public void invokeInterceptors( ClientRequestInfoImpl info, short op ) |
|
Lines 1714-1721
Link Here
|
| 1714 |
*/ |
1601 |
*/ |
| 1715 |
public void release( org.omg.CORBA.Object self ) |
1602 |
public void release( org.omg.CORBA.Object self ) |
| 1716 |
{ |
1603 |
{ |
| 1717 |
bind_sync.lock(); |
1604 |
synchronized ( bind_sync ) |
| 1718 |
try |
|
|
| 1719 |
{ |
1605 |
{ |
| 1720 |
if (!bound) |
1606 |
if (!bound) |
| 1721 |
{ |
1607 |
{ |
|
Lines 1739-1748
Link Here
|
| 1739 |
logger.debug("Delegate released!"); |
1625 |
logger.debug("Delegate released!"); |
| 1740 |
} |
1626 |
} |
| 1741 |
} |
1627 |
} |
| 1742 |
finally |
|
|
| 1743 |
{ |
| 1744 |
bind_sync.unlock(); |
| 1745 |
} |
| 1746 |
} |
1628 |
} |
| 1747 |
|
1629 |
|
| 1748 |
/** |
1630 |
/** |
|
Lines 1770-1777
Link Here
|
| 1770 |
{ |
1652 |
{ |
| 1771 |
orb.perform_work(); |
1653 |
orb.perform_work(); |
| 1772 |
|
1654 |
|
| 1773 |
bind_sync.lock(); |
1655 |
synchronized ( bind_sync ) |
| 1774 |
try |
|
|
| 1775 |
{ |
1656 |
{ |
| 1776 |
bind(); |
1657 |
bind(); |
| 1777 |
return new org.jacorb.orb.dii.Request( self, |
1658 |
return new org.jacorb.orb.dii.Request( self, |
|
Lines 1780-1789
Link Here
|
| 1780 |
getParsedIOR().get_object_key(), |
1661 |
getParsedIOR().get_object_key(), |
| 1781 |
operation ); |
1662 |
operation ); |
| 1782 |
} |
1663 |
} |
| 1783 |
finally |
|
|
| 1784 |
{ |
| 1785 |
bind_sync.unlock(); |
| 1786 |
} |
| 1787 |
} |
1664 |
} |
| 1788 |
|
1665 |
|
| 1789 |
/** |
1666 |
/** |
|
Lines 1817-1854
Link Here
|
| 1817 |
|
1694 |
|
| 1818 |
UtcT replyEndTime = getReplyEndTime(); |
1695 |
UtcT replyEndTime = getReplyEndTime(); |
| 1819 |
long roundtripTimeout = getRelativeRoundtripTimeout(); |
1696 |
long roundtripTimeout = getRelativeRoundtripTimeout(); |
| 1820 |
long timo = Long.MAX_VALUE; |
|
|
| 1821 |
|
1697 |
|
| 1822 |
if ((roundtripTimeout != 0) || (replyEndTime != null)) |
1698 |
if ((roundtripTimeout != 0) || (replyEndTime != null)) |
| 1823 |
{ |
1699 |
{ |
| 1824 |
replyEndTime = Time.earliest(Time.corbaFuture (roundtripTimeout), |
1700 |
replyEndTime = Time.earliest(Time.corbaFuture (roundtripTimeout), |
| 1825 |
replyEndTime); |
1701 |
replyEndTime); |
| 1826 |
if(replyEndTime != null) |
|
|
| 1827 |
{ |
| 1828 |
timo = Time.millisTo(replyEndTime); |
| 1829 |
} |
| 1830 |
|
| 1831 |
if (Time.hasPassed(replyEndTime)) |
1702 |
if (Time.hasPassed(replyEndTime)) |
| 1832 |
{ |
1703 |
{ |
| 1833 |
throw new TIMEOUT("Reply End Time exceeded prior to invocation", |
1704 |
throw new TIMEOUT("Reply End Time exceeded prior to invocation", |
| 1834 |
0, CompletionStatus.COMPLETED_NO); |
1705 |
0, CompletionStatus.COMPLETED_NO); |
| 1835 |
} |
1706 |
} |
| 1836 |
} |
1707 |
} |
| 1837 |
|
1708 |
|
| 1838 |
try |
1709 |
synchronized ( bind_sync ) |
| 1839 |
{ |
|
|
| 1840 |
if( bind_sync.tryLock(timo, TimeUnit.MILLISECONDS) == false) |
| 1841 |
{ |
| 1842 |
throw new TIMEOUT("Reply End Time exceeded prior to invocation", |
| 1843 |
0, CompletionStatus.COMPLETED_NO); |
| 1844 |
} |
| 1845 |
} |
| 1846 |
catch (InterruptedException e) |
| 1847 |
{ |
| 1848 |
throw new TRANSIENT("interrupted while request generation"); |
| 1849 |
} |
| 1850 |
|
| 1851 |
try |
| 1852 |
{ |
1710 |
{ |
| 1853 |
bind(); |
1711 |
bind(); |
| 1854 |
|
1712 |
|
|
Lines 1886-1895
Link Here
|
| 1886 |
|
1744 |
|
| 1887 |
return out; |
1745 |
return out; |
| 1888 |
} |
1746 |
} |
| 1889 |
finally |
|
|
| 1890 |
{ |
| 1891 |
bind_sync.unlock(); |
| 1892 |
} |
| 1893 |
} |
1747 |
} |
| 1894 |
|
1748 |
|
| 1895 |
/** |
1749 |
/** |
|
Lines 2089-2096
Link Here
|
| 2089 |
|
1943 |
|
| 2090 |
public String toString() |
1944 |
public String toString() |
| 2091 |
{ |
1945 |
{ |
| 2092 |
bind_sync.lock(); |
1946 |
synchronized ( bind_sync ) |
| 2093 |
try |
|
|
| 2094 |
{ |
1947 |
{ |
| 2095 |
if ( piorOriginal != null ) |
1948 |
if ( piorOriginal != null ) |
| 2096 |
{ |
1949 |
{ |
|
Lines 2098-2107
Link Here
|
| 2098 |
} |
1951 |
} |
| 2099 |
return getParsedIOR().getIORString(); |
1952 |
return getParsedIOR().getIORString(); |
| 2100 |
} |
1953 |
} |
| 2101 |
finally |
|
|
| 2102 |
{ |
| 2103 |
bind_sync.unlock(); |
| 2104 |
} |
| 2105 |
} |
1954 |
} |
| 2106 |
|
1955 |
|
| 2107 |
public String toString( org.omg.CORBA.Object self ) |
1956 |
public String toString( org.omg.CORBA.Object self ) |
|
Lines 2208-2249
Link Here
|
| 2208 |
this.notifyAll(); |
2057 |
this.notifyAll(); |
| 2209 |
} |
2058 |
} |
| 2210 |
} |
2059 |
} |
| 2211 |
|
|
|
| 2212 |
private class ThreadPerTaskExecutor implements Executor |
| 2213 |
{ |
| 2214 |
ThreadGroup group; |
| 2215 |
|
| 2216 |
ThreadPerTaskExecutor() |
| 2217 |
{ |
| 2218 |
group = new ThreadGroup("Job Runner"); |
| 2219 |
} |
| 2220 |
|
| 2221 |
public void execute(Runnable r) |
| 2222 |
{ |
| 2223 |
Thread t = new Thread(group, r); |
| 2224 |
t.setDaemon(true); |
| 2225 |
t.start(); |
| 2226 |
} |
| 2227 |
} |
| 2228 |
|
| 2229 |
// a SendJob is a helper class used to send requests in background |
| 2230 |
// |
| 2231 |
private class SendJob implements Callable |
| 2232 |
{ |
| 2233 |
private RequestOutputStream ros; |
| 2234 |
private ReplyReceiver receiver; |
| 2235 |
|
| 2236 |
SendJob(RequestOutputStream ros, ReplyReceiver receiver) |
| 2237 |
{ |
| 2238 |
this.ros = ros; |
| 2239 |
this.receiver = receiver; |
| 2240 |
} |
| 2241 |
|
| 2242 |
public java.lang.Object call() throws Exception |
| 2243 |
{ |
| 2244 |
doSend(ros, receiver); |
| 2245 |
|
| 2246 |
return(null); |
| 2247 |
} |
| 2248 |
} |
| 2249 |
} |
2060 |
} |